Skip to content

internetisgone/kms-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KMS bot

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

usage

start or reset purge task in a channel

@kms_bot_user 2d
@kms_bot_user 24h
@kms_bot_user 5m
@kms_bot_user 30s
or any custom duration

stop purge task in a channel

@kms_bot_user stop

get available commands

@kms_bot_user help

setup and run

python 3.8 or higher is required

clone this repo

git clone https://github.com/internetisgone/kms-bot.git
cd kms-bot

create a bot user

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

run the bot

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

hosting recommendations

hosting platforms with free tier

  • 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

vps self-hosting

im using screen rn but the proper way to do it would be adding it as a service in systemd

Releases

No releases published

Packages

No packages published