about summary refs log tree commit diff
path: root/MatrixAntiDmSpam
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-05-15 23:09:41 +0200
committerRory& <root@rory.gay>2025-05-15 23:10:54 +0200
commit5e13af7480fb40ff26a3e266217c0db702ee4b2f (patch)
treed00d1d104df7d3c29e3b9b8d3974d84eac4e8749 /MatrixAntiDmSpam
parentFix bug removing all policies that arent user added, theoretically fix missin... (diff)
downloadMatrixAntiDmSpam-5e13af7480fb40ff26a3e266217c0db702ee4b2f.tar.xz
Some various improvements, redo configuration, clean up example config
Diffstat (limited to 'MatrixAntiDmSpam')
-rw-r--r--MatrixAntiDmSpam/Program.cs4
-rw-r--r--MatrixAntiDmSpam/appsettings.Development.json53
2 files changed, 35 insertions, 22 deletions
diff --git a/MatrixAntiDmSpam/Program.cs b/MatrixAntiDmSpam/Program.cs

index 935e23f..5da7184 100644 --- a/MatrixAntiDmSpam/Program.cs +++ b/MatrixAntiDmSpam/Program.cs
@@ -1,4 +1,3 @@ -using LibMatrix.Extensions; using LibMatrix.Services; using LibMatrix.Utilities.Bot; using MatrixAntiDmSpam.Core; @@ -15,6 +14,9 @@ builder.Services.AddHostedService<PolicyExecutor>(); builder.Services.AddSingleton<PolicyStore>(); +builder.Configuration["LibMatrixBot:InviteListener:SyncConfiguration:MinimumSyncTime"] ??= builder.Configuration["AntiDmSpam:MinimumSyncTime"]; + + // MatrixHttpClient.LogRequests = false; var host = builder.Build(); diff --git a/MatrixAntiDmSpam/appsettings.Development.json b/MatrixAntiDmSpam/appsettings.Development.json
index 00d6dd4..8c69222 100644 --- a/MatrixAntiDmSpam/appsettings.Development.json +++ b/MatrixAntiDmSpam/appsettings.Development.json
@@ -7,43 +7,54 @@ } }, "LibMatrixBot": { - // Homeserver to connect to. + // Homeserver to connect to, or rather, where your account is hosted. // Note: Homeserver resolution is applied here, but a direct base URL can be used. "Homeserver": "rory.gay", // Absolute path to the file containing the access token + // Hint: log into https://riot.im/app/, go to Settings > Help & About > Advanced > Access Token, + // write this into a file, and then clear site data for riot.im so you don't accidentally log it out. + // Also, it's recommended to rename the session in your devices list "AccessTokenPath": "/home/Rory/matrix_access_token", - "InviteHandler": { - "SyncConfiguration": { - // How long to wait until the sync request times out - // "Timeout": 300000, - // Minimum sync interval, useful if you want to have less traffic than a normal client. - "MinimumSyncTime": "00:00:10.000", - - // What presence value to set - // Defaults to "online" if null or not set - "Presence": "offline", - - // Filter to apply to the sync request. Useful if you want custom data to be sent. - // "Filter": { }, - - // Whether to initial sync on startup - very useful in development, or just to be sure. + "InviteListener": { + "SyncConfiguration": { + // Whether to initial sync on startup + // Leaving this enabled is the same as doing a "Clear Cache & Reload" every time you restart the bot. + // This causes a slower startup, but increases reliability by a fairly large margin. "InitialSyncOnStartup": true } } }, "AntiDmSpam": { - // Whether invites should be logged to a room. - "LogRoom": "!GrLSwdAkdrvfMrRYKR:rory.gay", - "LogInviteDataAsFile": true, - // Whether to report users and rooms when an invite is blocked. + // Whether to log received/blocked invites into a room. + // This MUST be `null`, or a valid room ID (`!abcdefgh:yourserver.org`), not an alias (`#alias:yourserver.org`). + // WARNING: These messages, nor the optional files, are encrypted, even if the room has encryption enabled! + "LogRoom": null, + "LogInviteDataAsFile": true, // Also send the raw data as a file for manual reporting + + // Whether to report users and rooms when an invitation is blocked. + // Some homeserver admins may not like this, and consider it spam, hence the option to opt out :) "ReportBlockedInvites": true, + + // Automatically add banned users to your ignore list, also automatically removed automatic ignores when the policy is revoked. + // This is useful if you want to hide invites and messages from them. // WARNING: If you're a room moderator, this will cause your client to not receive events from ignored users! "IgnoreBannedUsers": true, - // Policy lists to follow + + // Minimum sync interval, useful if you want to have less traffic than a normal client. + // WARNING: this will also cause the bot to be slower to respond to invites/policies. + // This is considered to be a worthy tradeoff for both reduced energy usage, and reduced server load. + // ***ABSOLUTE*** minimum recommended value: 00:00:01.000 - but please don't use this unless you have a good reason, + // don't contribute to homeservers slowing down for everyone else. + "MinimumSyncTime": "00:00:05.000", + + // Policy lists to follow - must contain at least one list! + // What is a policy list? See https://matrix-community-help.codestorm.net/automated-tools.html#3 + // Hint: you might also see them referred to as banlists "PolicyLists": [ { + // Community Moderation Effort is a widely used policy list, and recommended as a base set for usage with MADS. "Name": "Community Moderation Effort", "RoomId": "!fTjMjIzNKEsFlUIiru:neko.dev", "Vias": [ "rory.gay" ]