about summary refs log tree commit diff
path: root/Utilities/LibMatrix.Utilities.Bot/Interfaces
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-15 09:50:45 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-15 09:50:45 +0200
commit6bd02248ccfbcb46960a6f39eaad23888d190eb5 (patch)
tree110578f31b6f9f70a7a1edab32fb3a34d6ad4f1a /Utilities/LibMatrix.Utilities.Bot/Interfaces
parentMedia moderator PoC works, abstract command handling to library (diff)
downloadLibMatrix-bak-6bd02248ccfbcb46960a6f39eaad23888d190eb5.tar.xz
Some refactoring
Diffstat (limited to 'Utilities/LibMatrix.Utilities.Bot/Interfaces')
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs b/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs

index 0ad3e09..bdb93d5 100644 --- a/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs +++ b/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs
@@ -1,3 +1,4 @@ +using LibMatrix; using LibMatrix.Homeservers; using LibMatrix.Responses; using LibMatrix.RoomTypes; @@ -10,7 +11,7 @@ public class CommandContext { public StateEventResponse MessageEvent { get; set; } public string MessageContentWithoutReply => - (MessageEvent.TypedContent as RoomMessageEventData)! + (MessageEvent.TypedContent as RoomMessageEventContent)! .Body.Split('\n') .SkipWhile(x => x.StartsWith(">")) .Aggregate((x, y) => $"{x}\n{y}"); @@ -18,4 +19,6 @@ public class CommandContext { public string CommandName => MessageContentWithoutReply.Split(' ')[0][1..]; public string[] Args => MessageContentWithoutReply.Split(' ')[1..]; public AuthenticatedHomeserverGeneric Homeserver { get; set; } + + public async Task<EventIdResponse> Reply(string eventType, RoomMessageEventContent content) => await Room.SendMessageEventAsync(eventType, content); }