about summary refs log tree commit diff
path: root/MiniUtils/Commands/MscCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MiniUtils/Commands/MscCommand.cs')
-rw-r--r--MiniUtils/Commands/MscCommand.cs24
1 files changed, 24 insertions, 0 deletions
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