Moderation bot work
3 files changed, 43 insertions, 17 deletions
diff --git a/LibMatrix/EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs b/LibMatrix/EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs
index 3e4a5cd..558e4fc 100644
--- a/LibMatrix/EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs
+++ b/LibMatrix/EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs
@@ -4,17 +4,17 @@ using LibMatrix.Interfaces;
namespace LibMatrix.EventTypes.Spec.State;
[MatrixEvent(EventName = "m.presence")]
-public class PresenceEventContent : TimelineEventContent {
- [JsonPropertyName("presence")]
- public string Presence { get; set; }
+public class PresenceEventContent : EventContent {
+ [JsonPropertyName("presence"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+ public string? Presence { get; set; }
[JsonPropertyName("last_active_ago")]
public long LastActiveAgo { get; set; }
[JsonPropertyName("currently_active")]
public bool CurrentlyActive { get; set; }
- [JsonPropertyName("status_msg")]
- public string StatusMessage { get; set; }
- [JsonPropertyName("avatar_url")]
- public string AvatarUrl { get; set; }
- [JsonPropertyName("displayname")]
- public string DisplayName { get; set; }
+ [JsonPropertyName("status_msg"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+ public string? StatusMessage { get; set; }
+ [JsonPropertyName("avatar_url"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+ public string? AvatarUrl { get; set; }
+ [JsonPropertyName("displayname"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+ public string? DisplayName { get; set; }
}
diff --git a/LibMatrix/EventTypes/Spec/RoomMessageEventContent.cs b/LibMatrix/EventTypes/Spec/RoomMessageEventContent.cs
index 1938b3e..8a22489 100644
--- a/LibMatrix/EventTypes/Spec/RoomMessageEventContent.cs
+++ b/LibMatrix/EventTypes/Spec/RoomMessageEventContent.cs
@@ -17,16 +17,29 @@ public class RoomMessageEventContent : TimelineEventContent {
public string MessageType { get; set; } = "m.notice";
[JsonPropertyName("formatted_body")]
- public string FormattedBody { get; set; }
+ public string? FormattedBody { get; set; }
[JsonPropertyName("format")]
- public string Format { get; set; }
+ public string? Format { get; set; }
/// <summary>
/// Media URI for this message, if any
/// </summary>
[JsonPropertyName("url")]
public string? Url { get; set; }
-
+
public string? FileName { get; set; }
+
+ [JsonPropertyName("info")]
+ public FileInfoStruct? FileInfo { get; set; }
+
+ public class FileInfoStruct {
+ [JsonPropertyName("mimetype")]
+ public string? MimeType { get; set; }
+ [JsonPropertyName("size")]
+ public long Size { get; set; }
+ [JsonPropertyName("thumbnail_url")]
+ public string? ThumbnailUrl { get; set; }
+ }
+
}
diff --git a/LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs b/LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
index 63f148c..757a9e9 100644
--- a/LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
+++ b/LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
@@ -3,10 +3,23 @@ using LibMatrix.Interfaces;
namespace LibMatrix.EventTypes.Spec.State;
-[MatrixEvent(EventName = "m.policy.rule.user")]
-[MatrixEvent(EventName = "m.policy.rule.server")]
-[MatrixEvent(EventName = "org.matrix.mjolnir.rule.server")]
-public class PolicyRuleEventContent : TimelineEventContent {
+//spec
+[MatrixEvent(EventName = "m.policy.rule.server")] //spec
+[MatrixEvent(EventName = "m.room.rule.server")] //???
+[MatrixEvent(EventName = "org.matrix.mjolnir.rule.server")] //legacy
+public class ServerPolicyRuleEventContent : PolicyRuleEventContent { }
+
+[MatrixEvent(EventName = "m.policy.rule.user")] //spec
+[MatrixEvent(EventName = "m.room.rule.user")] //???
+[MatrixEvent(EventName = "org.matrix.mjolnir.rule.user")] //legacy
+public class UserPolicyRuleEventContent : PolicyRuleEventContent { }
+
+[MatrixEvent(EventName = "m.policy.rule.room")] //spec
+[MatrixEvent(EventName = "m.room.rule.room")] //???
+[MatrixEvent(EventName = "org.matrix.mjolnir.rule.room")] //legacy
+public class RoomPolicyRuleEventContent : PolicyRuleEventContent { }
+
+public abstract class PolicyRuleEventContent : EventContent {
/// <summary>
/// Entity this ban applies to, can use * and ? as globs.
/// </summary>
@@ -52,4 +65,4 @@ public static class PolicyRecommendationTypes {
/// Mute this user
/// </summary>
public static string Mute = "support.feline.policy.recommendation_mute"; //stable prefix: m.mute, msc pending
-}
+}
\ No newline at end of file
|