Automatically redacts messages that aren't wanted. This works by using two accounts: one for monitoring rooms and finding banned messages and another for actually redacting them. This is so that moderators with large accounts can redact spam messages without having to /sync their potentially very large account. Moderators which do not have a second account can just use the same account as both the monitor and redactor.
The requirements for the monitor are:
- Must be in the rooms being monitored
- Must be a valid account
- Must be on the same homeserver as the account issuing the redactions
The requirements for the redactor are:
- Must be in the rooms being monitored
- Must be a valid account
- Must be on the same homeserver as the account listening for redactions
- Must have permission to redact messages (usually "moderator" or higher)
This script works with NodeJS 8.x or higher.
git clone https://gist.github.com/ef4ec647605b666cfae1f82f96aa5de6.git matrix-spam-redact
cd matrix-spam-redact
npm install
cp config.example.json config.json
vi config.json # Use your favourte editor to change the config
node index.js
# Copy the config.example.json to somewhere like /etc/matrix-spam-redact/config.json
vi /etc/matrix-spam-redact/config.json # Use your favourte editor to change the config
docker run -v /etc/matrix-spam-redact/config.json:/data/config.json turt2live/matrix-spam-redact
@turt2live: Thanks for providing this.
I wanted to use this with my relatively big account so introduced a filter. It might be a bigger than needed but as the sdk as a first step sends it to the server and continues using a filter id it should not be a problem). Hopefully that is of help for sb.
I changed
to