- Match all messages or edited messages against a list of spam strings
- Delete the messages and ban the senders of those messages from the current group
First you need to create a telegram bot. Check Bots: An introduction for developers. Then you need to enable privacy mode
for the bot, add it to your group , and promote it to an admin. Note: you need to enable privacy mode before adding it to your group. If you did it in the wrong order, remove the bot from your group, and add it back.
You can run the bot with cargo run --release
. In order for the bot to run, you need to set the following environment variables.
TELOXIDE_TOKEN="..." SPAM_STR="..."
TELOXIDE_TOKEN
is your telegram bot API token. SPAM_STR
is a string of the spam strings you want to detect against, separated with colon, e.g. this is a spam:this is another spam
.
An easy way to run is put the following in a script, and run before calling cargo run --release
export TELOXIDE_TOKEN="..."
# uncomment the following to change logging level
# export RUST_LOG=info
export SPAM_STR="..."
AGPL-3.0-or-later