about summary refs log tree commit diff
path: root/ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-05 06:28:52 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-05 06:28:52 +0200
commitcf455ed8de20bbee011289223e7d8d5775dfd69e (patch)
treecbdfdbc207af64a105b4d21941a6f0e71ca65e9d /ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs
parentAdd start of Media Moderator PoC bot (diff)
downloadLibMatrix-cf455ed8de20bbee011289223e7d8d5775dfd69e.tar.xz
Media moderator PoC works, abstract command handling to library
Diffstat (limited to 'ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs')
-rw-r--r--ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs22
1 files changed, 15 insertions, 7 deletions
diff --git a/ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs b/ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs
index 812ccf2..f37d33c 100644
--- a/ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs
+++ b/ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs
@@ -4,15 +4,20 @@ using LibMatrix.Interfaces;
 
 namespace MediaModeratorPoC.Bot.StateEventTypes;
 
-
+[MatrixEvent(EventName = "gay.rory.media_moderator_poc.rule.homeserver")]
 [MatrixEvent(EventName = "gay.rory.media_moderator_poc.rule.media")]
 public class MediaPolicyStateEventData : IStateEventType {
     /// <summary>
-    ///     Entity this ban applies to, can use * and ? as globs.
-    ///     This is an MXC URI.
+    ///     This is an MXC URI, hashed with SHA3-256.
     /// </summary>
     [JsonPropertyName("entity")]
-    public string Entity { get; set; }
+    public byte[] Entity { get; set; }
+
+    /// <summary>
+    /// Server this ban applies to, can use * and ? as globs.
+    /// </summary>
+    [JsonPropertyName("server_entity")]
+    public string? ServerEntity { get; set; }
 
     /// <summary>
     ///     Reason this user is banned
@@ -21,10 +26,10 @@ public class MediaPolicyStateEventData : IStateEventType {
     public string? Reason { get; set; }
 
     /// <summary>
-    ///     Suggested action to take
+    ///     Suggested action to take, one of `ban`, `kick`, `mute`, `redact`, `spoiler`, `warn` or `warn_admins`
     /// </summary>
     [JsonPropertyName("recommendation")]
-    public string? Recommendation { get; set; }
+    public string Recommendation { get; set; } = "warn";
 
     /// <summary>
     ///     Expiry time in milliseconds since the unix epoch, or null if the ban has no expiry.
@@ -39,6 +44,9 @@ public class MediaPolicyStateEventData : IStateEventType {
     [JsonPropertyName("gay.rory.matrix_room_utils.readable_expiry_time_utc")]
     public DateTime? ExpiryDateTime {
         get => Expiry == null ? null : DateTimeOffset.FromUnixTimeMilliseconds(Expiry.Value).DateTime;
-        set => Expiry = ((DateTimeOffset)value).ToUnixTimeMilliseconds();
+        set => Expiry = value is null ? null : ((DateTimeOffset)value).ToUnixTimeMilliseconds();
     }
+
+    [JsonPropertyName("file_hash")]
+    public byte[]? FileHash { get; set; }
 }