You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.4 KiB


Discord bot that enforces the rules on my server. The bot is currently running on dubsdot2.


Clone the repo

git clone

Ignore the error and checkout the main branch

cd EnforcerBot2
git checkout main

Create a .env file and add your bot's api token like so:

TOKEN=<copy and paste the token>

Finally as root bring the service up with docker-compose

sudo docker-compose up -d

Adding rules

Rules are relatively straight forward to add. In rules.ts there is a Map named rules that maps strings to callback functions; like so:

var rules : Map<string, (msg: Discord.Message) => void> = new Map();

So adding a new rule is as simple as:

// # no posting whatsoever
rules.set("826181775981019156", function(msg) {

Now whenever a message is posted or edited index.ts will check if has an associated function and, if so, it will call that with msg:

// get the rule
let rule : ((msg: Discord.Message) => void) | undefined = rules.get(;
// check if the rule exists
if (rule != undefined) {
    // callback