From ddb5a61b0fd234b436c0406ab57e38d67429c6b8 Mon Sep 17 00:00:00 2001 From: Rory& Date: Tue, 13 May 2025 08:17:26 +0200 Subject: Initial commit --- MiniUtils/Commands/MscCommand.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 MiniUtils/Commands/MscCommand.cs (limited to 'MiniUtils/Commands/MscCommand.cs') diff --git a/MiniUtils/Commands/MscCommand.cs b/MiniUtils/Commands/MscCommand.cs new file mode 100644 index 0000000..62f1bd7 --- /dev/null +++ b/MiniUtils/Commands/MscCommand.cs @@ -0,0 +1,24 @@ +using LibMatrix.Extensions; +using LibMatrix.Helpers; +using LibMatrix.Utilities.Bot.Interfaces; +using MiniUtils.Utilities; + +namespace MiniUtils.Commands; + +public class MscCommand(MscInfoProvider mscInfoProvider) : ICommand { + public string Name { get; } = "msc"; + public string[]? Aliases { get; } = []; + public string Description { get; } = "Get MSC info"; + public bool Unlisted { get; } = false; + + public async Task Invoke(CommandContext ctx) { + var msb = new MessageBuilder("m.notice"); + var id = int.Parse(ctx.Args[0]); + var mscInfo = await mscInfoProvider.GetMscInfo(id); + + msb.WithBody(mscInfo?.ToHtml() ?? "No info found!"); + + await ctx.Reply(msb.Build()); + Console.WriteLine(msb.Build().FormattedBody); + } +} \ No newline at end of file -- cgit 1.5.1