about summary refs log tree commit diff
path: root/MatrixContentFilter/Commands/RedactCommand.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-03-12 19:52:15 +0100
committerRory& <root@rory.gay>2025-03-12 19:52:15 +0100
commitbdf058ab5c936463a022f62ffbb55bb71c26e856 (patch)
tree69914accad80f10dd8d87e3738e820c58f042537 /MatrixContentFilter/Commands/RedactCommand.cs
parentInitial commit (diff)
downloadMatrixContentFilter-master.tar.xz
More work HEAD master
Diffstat (limited to 'MatrixContentFilter/Commands/RedactCommand.cs')
-rw-r--r--MatrixContentFilter/Commands/RedactCommand.cs15
1 files changed, 6 insertions, 9 deletions
diff --git a/MatrixContentFilter/Commands/RedactCommand.cs b/MatrixContentFilter/Commands/RedactCommand.cs

index 6b2f8b6..9d45f18 100644 --- a/MatrixContentFilter/Commands/RedactCommand.cs +++ b/MatrixContentFilter/Commands/RedactCommand.cs
@@ -1,14 +1,11 @@ using ArcaneLibs.Extensions; using LibMatrix.EventTypes.Spec; -using LibMatrix.EventTypes.Spec.State; +using LibMatrix.EventTypes.Spec.State.RoomInfo; 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; @@ -54,11 +51,11 @@ public class RedactCommand( Key = "\u23f3" //hour glass emoji } }); - - await foreach (var resp in ctx.Room.GetManyMessagesAsync(limit: count, chunkSize: Math.Min(count, 250) - ,filter: new SyncFilter.RoomFilter.StateFilter(types: [RoomMemberEventContent.EventId, RoomMessageEventContent.EventId], senders: [mxid]) + + await foreach (var resp in ctx.Room.GetManyMessagesAsync(limit: count, chunkSize: Math.Min(count, 250), + filter: new SyncFilter.RoomFilter.StateFilter(types: [RoomMemberEventContent.EventId, RoomMessageEventContent.EventId], senders: [mxid]) .ToJson(indent: false, ignoreNull: true).UrlEncode()) - ) { + ) { foreach (var msg in resp.Chunk) { if (msg.Sender != mxid) continue; if (msg is not { Type: RoomMemberEventContent.EventId or RoomMessageEventContent.EventId }) continue; @@ -85,7 +82,7 @@ public class RedactCommand( .Build()); }); } - + await ctx.Room.RedactEventAsync(hourglassReaction.EventId); await ctx.Room.SendTimelineEventAsync("m.reaction", new RoomMessageReactionEventContent() { RelatesTo = new() {