about summary refs log tree commit diff
path: root/MatrixContentFilter/Commands/DumpEventCommand.cs
blob: ebffcd4355c0f133268266f87589862f58420238 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using ArcaneLibs.Extensions;
using LibMatrix.Helpers;
using LibMatrix.Utilities.Bot.Interfaces;
using MatrixContentFilter.Services;
using MatrixContentFilter.Services.AsyncActionQueues;

namespace MatrixContentFilter.Commands;

public class DumpEventCommand(
    ConfigurationService filterConfigService,
    AsyncMessageQueue msgQueue,
    InfoCacheService infoCache,
    ConfigurationService cfgService,
    AbstractAsyncActionQueue actionQueue
) : ICommand {
    public string Name { get; } = "dump";
    public string[]? Aliases { get; } = [];
    public string Description { get; } = "Dump event by ID";
    public bool Unlisted { get; } = false;

    public async Task Invoke(CommandContext ctx) {
        var evt = await ctx.Room.GetEventAsync(ctx.Args[0]);
        await ctx.Room.SendMessageEventAsync(new MessageBuilder("m.notice").WithBody(evt.ToJson(ignoreNull: true)).Build());
    }
}