about summary refs log tree commit diff
path: root/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs')
-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);
 }