From cf455ed8de20bbee011289223e7d8d5775dfd69e Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Tue, 5 Sep 2023 06:28:52 +0200 Subject: Media moderator PoC works, abstract command handling to library --- .../MediaModeratorPoC/Bot/Commands/HelpCommand.cs | 25 ---------------------- 1 file changed, 25 deletions(-) delete mode 100644 ExampleBots/MediaModeratorPoC/Bot/Commands/HelpCommand.cs (limited to 'ExampleBots/MediaModeratorPoC/Bot/Commands/HelpCommand.cs') diff --git a/ExampleBots/MediaModeratorPoC/Bot/Commands/HelpCommand.cs b/ExampleBots/MediaModeratorPoC/Bot/Commands/HelpCommand.cs deleted file mode 100644 index 8d63daa..0000000 --- a/ExampleBots/MediaModeratorPoC/Bot/Commands/HelpCommand.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text; -using LibMatrix.StateEventTypes.Spec; -using MediaModeratorPoC.Bot.Interfaces; -using Microsoft.Extensions.DependencyInjection; - -namespace MediaModeratorPoC.Bot.Commands; - -public class HelpCommand(IServiceProvider services) : ICommand { - public string Name { get; } = "help"; - public string Description { get; } = "Displays this help message"; - - public async Task Invoke(CommandContext ctx) { - var sb = new StringBuilder(); - sb.AppendLine("Available commands:"); - var commands = services.GetServices().ToList(); - foreach (var command in commands) { - sb.AppendLine($"- {command.Name}: {command.Description}"); - } - - await ctx.Room.SendMessageEventAsync("m.room.message", new RoomMessageEventData { - MessageType = "m.notice", - Body = sb.ToString() - }); - } -} -- cgit 1.4.1