diff options
Diffstat (limited to 'ExampleBots/ModerationBot/Commands/JoinRoomCommand.cs')
-rw-r--r-- | ExampleBots/ModerationBot/Commands/JoinRoomCommand.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ExampleBots/ModerationBot/Commands/JoinRoomCommand.cs b/ExampleBots/ModerationBot/Commands/JoinRoomCommand.cs index 19a2c54..7496a07 100644 --- a/ExampleBots/ModerationBot/Commands/JoinRoomCommand.cs +++ b/ExampleBots/ModerationBot/Commands/JoinRoomCommand.cs @@ -19,7 +19,7 @@ public class JoinRoomCommand(IServiceProvider services, HomeserverProviderServic //check if user is admin in control room var botData = await ctx.Homeserver.GetAccountDataAsync<BotData>("gay.rory.moderation_bot_data"); var controlRoom = ctx.Homeserver.GetRoom(botData.ControlRoom); - var isAdmin = (await controlRoom.GetPowerLevelsAsync())!.UserHasPermission(ctx.MessageEvent.Sender, "m.room.ban"); + var isAdmin = (await controlRoom.GetPowerLevelsAsync())!.UserHasStatePermission(ctx.MessageEvent.Sender, "m.room.ban"); if (!isAdmin) { // await ctx.Reply("You do not have permission to use this command!"); await ctx.Homeserver.GetRoom(botData.LogRoom!).SendMessageEventAsync( @@ -30,16 +30,16 @@ public class JoinRoomCommand(IServiceProvider services, HomeserverProviderServic } public async Task Invoke(CommandContext ctx) { - + var botData = await ctx.Homeserver.GetAccountDataAsync<BotData>("gay.rory.moderation_bot_data"); var policyRoom = ctx.Homeserver.GetRoom(botData.DefaultPolicyRoom ?? botData.ControlRoom); var logRoom = ctx.Homeserver.GetRoom(botData.LogRoom ?? botData.ControlRoom); await logRoom.SendMessageEventAsync(MessageFormatter.FormatSuccess($"Joining room {ctx.Args[0]} with reason: {string.Join(' ', ctx.Args[1..])}")); var roomId = ctx.Args[0]; - var servers = new List<string>() {ctx.Homeserver.ServerName}; + var servers = new List<string>() { ctx.Homeserver.ServerName }; if (roomId.StartsWith('[')) { - + } if (roomId.StartsWith('#')) { |