about summary refs log tree commit diff
path: root/MatrixContentFilter/Commands/DumpEventCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixContentFilter/Commands/DumpEventCommand.cs')
-rw-r--r--MatrixContentFilter/Commands/DumpEventCommand.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/MatrixContentFilter/Commands/DumpEventCommand.cs b/MatrixContentFilter/Commands/DumpEventCommand.cs
new file mode 100644
index 0000000..5131e19
--- /dev/null
+++ b/MatrixContentFilter/Commands/DumpEventCommand.cs
@@ -0,0 +1,31 @@
+using ArcaneLibs.Extensions;
+using LibMatrix.EventTypes.Spec;
+using LibMatrix.EventTypes.Spec.State;
+using LibMatrix.Filters;
+using LibMatrix.Helpers;
+using LibMatrix.Homeservers;
+using LibMatrix.Utilities.Bot.Interfaces;
+using MatrixContentFilter.Abstractions;
+using MatrixContentFilter.Services;
+using MatrixContentFilter.Services.AsyncActionQueues;
+using Microsoft.Extensions.Logging;
+
+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());
+    }
+}
\ No newline at end of file