Code Monkey home page Code Monkey logo

kms-bot's Introduction

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

kms-bot's People

Contributors

internetisgone avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.