diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-04 06:29:00 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-04 06:29:00 +0200 |
commit | 9dcce18cda5317ea1150eed06d6589b6285577e6 (patch) | |
tree | 1b36a9ddffa312e58daab075c43fb482c2bae905 /ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs | |
parent | Too many changes to name... (diff) | |
download | LibMatrix-9dcce18cda5317ea1150eed06d6589b6285577e6.tar.xz |
Add start of Media Moderator PoC bot
Diffstat (limited to '')
-rw-r--r-- | ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs b/ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs new file mode 100644 index 0000000..812ccf2 --- /dev/null +++ b/ExampleBots/MediaModeratorPoC/Bot/StateEventTypes/MediaPolicyStateEventData.cs @@ -0,0 +1,44 @@ +using System.Text.Json.Serialization; +using LibMatrix.Helpers; +using LibMatrix.Interfaces; + +namespace MediaModeratorPoC.Bot.StateEventTypes; + + +[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. + /// </summary> + [JsonPropertyName("entity")] + public string Entity { get; set; } + + /// <summary> + /// Reason this user is banned + /// </summary> + [JsonPropertyName("reason")] + public string? Reason { get; set; } + + /// <summary> + /// Suggested action to take + /// </summary> + [JsonPropertyName("recommendation")] + public string? Recommendation { get; set; } + + /// <summary> + /// Expiry time in milliseconds since the unix epoch, or null if the ban has no expiry. + /// </summary> + [JsonPropertyName("support.feline.policy.expiry.rev.2")] //stable prefix: expiry, msc pending + public long? Expiry { get; set; } + + //utils + /// <summary> + /// Readable expiry time, provided for easy interaction + /// </summary> + [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(); + } +} |