diff options
author | Emma [it/its]@Rory& <root@rory.gay> | 2024-02-23 12:33:45 +0100 |
---|---|---|
committer | Emma [it/its]@Rory& <root@rory.gay> | 2024-02-23 12:33:55 +0100 |
commit | c7b7dbe3d929d787fe0c76015082a117c4222278 (patch) | |
tree | db765a9655f875d751f061e1000e199dd209d841 /Utilities/LibMatrix.Utilities.Bot | |
parent | HS emulator (diff) | |
download | LibMatrix-c7b7dbe3d929d787fe0c76015082a117c4222278.tar.xz |
Unknown changes
Diffstat (limited to 'Utilities/LibMatrix.Utilities.Bot')
-rw-r--r-- | Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs index 11ee740..d9e4dc8 100644 --- a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs +++ b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs @@ -1,4 +1,6 @@ +using System.Reflection.Metadata; using LibMatrix.EventTypes.Spec; +using LibMatrix.Filters; using LibMatrix.Helpers; using LibMatrix.Homeservers; using LibMatrix.Utilities.Bot.Interfaces; @@ -37,8 +39,19 @@ public class CommandListenerHostedService : IHostedService { private async Task? Run(CancellationToken cancellationToken) { _logger.LogInformation("Starting command listener!"); + var filter = await _hs.GetOrUploadNamedFilterIdAsync("gay.rory.libmatrix.utilities.bot.command_listener_syncfilter.dev2", new SyncFilter() { + AccountData = new SyncFilter.EventFilter(notTypes: ["*"], limit: 1), + Presence = new SyncFilter.EventFilter(notTypes: ["*"]), + Room = new SyncFilter.RoomFilter() { + AccountData = new SyncFilter.RoomFilter.StateFilter(notTypes: ["*"]), + Ephemeral = new SyncFilter.RoomFilter.StateFilter(notTypes: ["*"]), + State = new SyncFilter.RoomFilter.StateFilter(notTypes: ["*"]), + Timeline = new SyncFilter.RoomFilter.StateFilter(types: ["m.room.message"], notSenders: [_hs.WhoAmI.UserId]), + } + }); var syncHelper = new SyncHelper(_hs, _logger) { - Timeout = 300_000 + Timeout = 300_000, + FilterId = filter }; syncHelper.TimelineEventHandlers.Add(async @event => { try { |