From 6bd02248ccfbcb46960a6f39eaad23888d190eb5 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Fri, 15 Sep 2023 09:50:45 +0200 Subject: Some refactoring --- Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs') 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 Reply(string eventType, RoomMessageEventContent content) => await Room.SendMessageEventAsync(eventType, content); } -- cgit 1.4.1