about summary refs log tree commit diff
path: root/Commands/JoinRoomCommand.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-03-22 17:43:00 +0100
committerRory& <root@rory.gay>2024-03-22 17:43:00 +0100
commitc137f94aeb122c636629fb9361dd73626594f690 (patch)
tree44f04e0b2b026d21c817e330918243fd5a4a8cd4 /Commands/JoinRoomCommand.cs
parentChanges (diff)
downloadModerationBot-c137f94aeb122c636629fb9361dd73626594f690.tar.xz
Changes
Diffstat (limited to 'Commands/JoinRoomCommand.cs')
-rw-r--r--Commands/JoinRoomCommand.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Commands/JoinRoomCommand.cs b/Commands/JoinRoomCommand.cs

index eb22a70..e604a4e 100644 --- a/Commands/JoinRoomCommand.cs +++ b/Commands/JoinRoomCommand.cs
@@ -8,7 +8,9 @@ namespace ModerationBot.Commands; public class JoinRoomCommand(IServiceProvider services, HomeserverProviderService hsProvider, HomeserverResolverService hsResolver, PolicyEngine engine) : ICommand { public string Name { get; } = "join"; + public string[]? Aliases { get; } public string Description { get; } = "Join arbitrary rooms"; + public bool Unlisted { get; } public async Task<bool> CanInvoke(CommandContext ctx) { //check if user is admin in control room @@ -25,7 +27,6 @@ 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); @@ -33,9 +34,7 @@ public class JoinRoomCommand(IServiceProvider services, HomeserverProviderServic 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 }; - if (roomId.StartsWith('[')) { - - } + if (roomId.StartsWith('[')) { } if (roomId.StartsWith('#')) { var res = await ctx.Homeserver.ResolveRoomAliasAsync(roomId); @@ -46,4 +45,4 @@ public class JoinRoomCommand(IServiceProvider services, HomeserverProviderServic await ctx.Homeserver.JoinRoomAsync(roomId, servers, string.Join(' ', ctx.Args[1..])); await logRoom.SendMessageEventAsync(MessageFormatter.FormatSuccess($"Resolved room {ctx.Args[0]} to {roomId} with servers: {string.Join(", ", servers)}")); } -} +} \ No newline at end of file