From c137f94aeb122c636629fb9361dd73626594f690 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 22 Mar 2024 17:43:00 +0100 Subject: Changes --- Commands/JoinRoomCommand.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Commands/JoinRoomCommand.cs') 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 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("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() { 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 -- cgit 1.5.1