diff options
author | Emma [it/its]@Rory& <root@rory.gay> | 2023-11-23 05:42:33 +0100 |
---|---|---|
committer | Emma [it/its]@Rory& <root@rory.gay> | 2023-11-23 05:42:33 +0100 |
commit | 3e934eee892f69a8f78b94950993000522702769 (patch) | |
tree | 6aa0d3d26c9a07a7a3e097fe28abb785400bfbd6 /ExampleBots/MediaModeratorPoC/StateEventTypes | |
parent | Add license retroactively, matching where the code originated from (MatrixRoo... (diff) | |
download | LibMatrix-3e934eee892f69a8f78b94950993000522702769.tar.xz |
Moderation bot work
Diffstat (limited to 'ExampleBots/MediaModeratorPoC/StateEventTypes')
-rw-r--r-- | ExampleBots/MediaModeratorPoC/StateEventTypes/BasePolicy.cs | 43 | ||||
-rw-r--r-- | ExampleBots/MediaModeratorPoC/StateEventTypes/MediaPolicyStateEventData.cs | 17 |
2 files changed, 0 insertions, 60 deletions
diff --git a/ExampleBots/MediaModeratorPoC/StateEventTypes/BasePolicy.cs b/ExampleBots/MediaModeratorPoC/StateEventTypes/BasePolicy.cs deleted file mode 100644 index 7735314..0000000 --- a/ExampleBots/MediaModeratorPoC/StateEventTypes/BasePolicy.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Text.Json.Serialization; -using LibMatrix; -using LibMatrix.Interfaces; - -namespace MediaModeratorPoC.StateEventTypes; - -public abstract class BasePolicy : EventContent { - /// <summary> - /// Entity this policy applies to - /// </summary> - [JsonPropertyName("entity")] - public string Entity { get; set; } - - /// <summary> - /// Reason this policy exists - /// </summary> - [JsonPropertyName("reason")] - public string? Reason { get; set; } - - /// <summary> - /// Suggested action to take, one of `ban`, `kick`, `mute`, `redact`, `spoiler`, `warn` or `warn_admins` - /// </summary> - [JsonPropertyName("recommendation")] - [AllowedValues("ban", "kick", "mute", "redact", "spoiler", "warn", "warn_admins")] - public string Recommendation { get; set; } = "warn"; - - /// <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 = value is null ? null : ((DateTimeOffset)value).ToUnixTimeMilliseconds(); - } -} diff --git a/ExampleBots/MediaModeratorPoC/StateEventTypes/MediaPolicyStateEventData.cs b/ExampleBots/MediaModeratorPoC/StateEventTypes/MediaPolicyStateEventData.cs deleted file mode 100644 index 603a858..0000000 --- a/ExampleBots/MediaModeratorPoC/StateEventTypes/MediaPolicyStateEventData.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Text.Json.Serialization; -using LibMatrix.EventTypes; - -namespace MediaModeratorPoC.StateEventTypes; - -/// <summary> -/// File policy event, entity is the MXC URI of the file, hashed with SHA3-256. -/// </summary> -[MatrixEvent(EventName = "gay.rory.media_moderator_poc.rule.homeserver")] -[MatrixEvent(EventName = "gay.rory.media_moderator_poc.rule.media")] -public class MediaPolicyEventContent : BasePolicy { - /// <summary> - /// Hash of the file - /// </summary> - [JsonPropertyName("file_hash")] - public byte[]? FileHash { get; set; } -} |