Media moderator PoC works, abstract command handling to library
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; }
}
|