discord bot that periodically deletes old messages in text channels using purge
- custom duration for each channel
- pinned messages are kept
- minimal permissions (no message content access)
- purge tasks are kept in a local SQLite database and resumed on bot restart
rest in peace @AutoDelete#6949 which inspired this project
@kms_bot_user 2d
@kms_bot_user 24h
@kms_bot_user 5m
@kms_bot_user 30s
or any custom duration
@kms_bot_user stop
@kms_bot_user help
python 3.8 or higher is required
git clone https://github.com/internetisgone/kms-bot.git
cd kms-bot
go to discord developer portal and create a new application
in the "bot" section, copy its token and paste it in .env.example
, and rename the file to .env
. optionally, uncheck "public bot"
in the "OAuth2 - URL generator" section, set scope to bot
, and select the send messages
, manage messages
, and read message history
permissions. invite the bot to your server with the link
create and activate a venv
# macos and linux
python3 -m venv .venv
source .venv/bin/activate
# windows
py -m venv .venv
.venv\Scripts\activate.bat
install requirements
pip install -r requirements.txt
run the bot
# macos and linux
python3 main.py
# windows
py main.py
- fly.io. it will build the bot from the
Dockerfile
. u need to configure a volume for the sqlite db to work - pythonanywhere. afaik it has persistent storage but the machine gets restarted quite often
im using screen
rn but the proper way to do it would be adding it as a service in systemd