about summary refs log tree commit diff
path: root/ExampleBots/LibMatrix.ExampleBot/Bot/MRUBot.cs
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 /ExampleBots/LibMatrix.ExampleBot/Bot/MRUBot.cs
parentMedia moderator PoC works, abstract command handling to library (diff)
downloadLibMatrix-6bd02248ccfbcb46960a6f39eaad23888d190eb5.tar.xz
Some refactoring
Diffstat (limited to '')
-rw-r--r--ExampleBots/LibMatrix.ExampleBot/Bot/MRUBot.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/ExampleBots/LibMatrix.ExampleBot/Bot/MRUBot.cs b/ExampleBots/LibMatrix.ExampleBot/Bot/MRUBot.cs
index 3f69d90..0b4e2ba 100644
--- a/ExampleBots/LibMatrix.ExampleBot/Bot/MRUBot.cs
+++ b/ExampleBots/LibMatrix.ExampleBot/Bot/MRUBot.cs
@@ -58,7 +58,7 @@ public class MRUBot : IHostedService {
                 args.Value.InviteState.Events.FirstOrDefault(x =>
                     x.Type == "m.room.member" && x.StateKey == hs.WhoAmI.UserId);
             _logger.LogInformation(
-                $"Got invite to {args.Key} by {inviteEvent.Sender} with reason: {(inviteEvent.TypedContent as RoomMemberEventData).Reason}");
+                $"Got invite to {args.Key} by {inviteEvent.Sender} with reason: {(inviteEvent.TypedContent as RoomMemberEventContent).Reason}");
             if (inviteEvent.Sender.EndsWith(":rory.gay") || inviteEvent.Sender == "@mxidupwitch:the-apothecary.club") {
                 try {
                     var senderProfile = await hs.GetProfile(inviteEvent.Sender);
@@ -76,12 +76,12 @@ public class MRUBot : IHostedService {
 
             var room = await hs.GetRoom(@event.RoomId);
             // _logger.LogInformation(eventResponse.ToJson(indent: false));
-            if (@event is { Type: "m.room.message", TypedContent: RoomMessageEventData message }) {
+            if (@event is { Type: "m.room.message", TypedContent: RoomMessageEventContent message }) {
                 if (message is { MessageType: "m.text" } && message.Body.StartsWith(_configuration.Prefix)) {
                     var command = _commands.FirstOrDefault(x => x.Name == message.Body.Split(' ')[0][_configuration.Prefix.Length..]);
                     if (command == null) {
                         await room.SendMessageEventAsync("m.room.message",
-                            new RoomMessageEventData(messageType: "m.text", body: "Command not found!"));
+                            new RoomMessageEventContent(messageType: "m.text", body: "Command not found!"));
                         return;
                     }
 
@@ -94,7 +94,7 @@ public class MRUBot : IHostedService {
                     }
                     else {
                         await room.SendMessageEventAsync("m.room.message",
-                            new RoomMessageEventData(messageType: "m.text", body: "You do not have permission to run this command!"));
+                            new RoomMessageEventContent(messageType: "m.text", body: "You do not have permission to run this command!"));
                     }
                 }
             }