What it does
Automod signs in, joins the room(s) you decide, and reads new messages. A hit is deleted. Repeat hits from the same person within an hour fire automated moderation: warnings for the first two hits, a 5 minute mute for the 3rd hit, a kick for the 4th hit, then a permanent ban for the 5th hit. File attachments are counted per user across watched rooms.
Set up the account
- Register an account on the server you want it to watch. Bot mode is per server, so an automod on
your-server.divcord.ggdoes not run on the main site. - Make that account a room moderator (or a server admin) in every room it should police.
- Open Settings and choose Enable Bot Mode or Bot token under Account. Confirm with the account password and copy the token. It is only shown once.
Download and run
You need Node.js on the machine that will keep the bot online. Download the library and the automod script from any Divcord host:
curl -O https://divcord.gg/bot/index.js
curl -O https://divcord.gg/bot/automod.js
npm install socket.io-client
Create a token from the command line if you prefer that to Settings:
DIVCORD_SERVER=your-server \
DIVCORD_USERNAME=automod \
DIVCORD_PASSWORD='your-password' \
node automod.js --enable
Then start it. Put each setting on its own line, with no spaces around =.
DIVCORD_SERVER=your-server \
DIVCORD_USERNAME=automod \
DIVCORD_BOT_TOKEN=dcbot_... \
DIVCORD_ROOMS=general \
node automod.js
When it is up you will see that it signed in, which rooms it is
watching, and Automod ready. Leave that window open
(or run it under whatever process manager you already use).
Settings you pass in
These are environment variables: values the script reads when it
starts. The name is DIVCORD_BOT_TOKEN, not
DIVCORD_TOKEN.
| Name | Required | What it is |
|---|---|---|
DIVCORD_USERNAME | yes | The registered account |
DIVCORD_BOT_TOKEN | yes* | Token from Settings or --enable |
DIVCORD_PASSWORD | for --enable | That account's password |
DIVCORD_SERVER | no | Server name. Use default or omit it for divcord.gg. Use your-server for your-server.divcord.gg. |
DIVCORD_URL | no | Only if you self-host and need a different origin |
DIVCORD_ROOM | no | One room. Defaults to general. |
DIVCORD_ROOMS | no | Comma-separated rooms, or all for every public room |
DIVCORD_PREFIX | no | Command prefix. Defaults to ! |
DIVCORD_AUTOMOD_CONFIG | no | Where to save live settings. Defaults to a file next to the script. |
DIVCORD_AUTOMOD_LOG | no | Set to 0 to hide action logs |
* You can log in with DIVCORD_PASSWORD instead of a token. A token is the usual choice.
Filters
Turn any of these off in chat with !automod filter <name> off.
| Name | When it fires |
|---|---|
blocklist | A built-in slur list, plus words you add with !automod word add |
flood | 6 messages from one person in the same room within 8 seconds |
duplicate | The same text (4 or more characters) 3 times in 45 seconds |
caps | 12 or more letters, and at least 80% of them uppercase |
links | More than 3 web links in one message |
zalgo | Heavy accent stacking, or one character repeated 15+ times |
uploads | 10 files from one person within 1 hour, counted across watched rooms. Each attachment on a message counts as one file. |
Messages that start with the command prefix are left alone so staff can still type commands.
File counts are recorded as soon as a message with attachments arrives, even if another filter
already handles that message. The uploads strike only fires when no earlier filter hit.
Strike ladder
Strikes are counted per username, across the rooms automod is in. They expire after one hour.
- Delete the message and warn (strikes 1 and 2).
- Delete and mute for 5 minutes (strike 3). Automod unmutes when the 5 minutes are up.
- Delete and kick (strike 4).
- Delete and ban (strike 5 and later in that hour).
A short cooldown stops a flood from jumping the whole ladder in one burst. If mute, kick, or ban is not allowed in that room, automod still tries to delete the message and says so in chat.
When the hit is a blocked word, the room notice shows a censored form (first and last letter only). The uncensored word is sent to that person in a private message. Other filter reasons stay visible in the room.
Who is skipped
- The automod account
- The room owner
- Room moderators
- The server owner
- Anyone added with
!automod exempt add <user>
Commands in chat
The prefix defaults to !. !am is a shortcut for
!automod. Only the people listed above can run these.
| Command | What it does |
|---|---|
!automod help | List subcommands |
!automod status | On or off, which filters are live, how many custom words |
!automod on / off | Pause or resume filtering |
!automod filter <name> on|off | Toggle one filter |
!automod word add|remove|list | Custom blocklist |
!automod exempt add|remove|list | Extra people the filters ignore |
!automod strikes <user> | Hits in the current hour |
!automod clear <user> | Reset that person's ladder |
!automod kick|ban|mute <user> [duration] | Act on someone in this room |
!automod unmute|unban <user> | Lift a mute or ban early |
!automod wipe [user] | Delete that person's messages in this room, or every message if no user is given |
Kick, mute, ban
Only room moderators, the room owner, and server admins can use these. Automod then performs the action as its own account, so that account still needs permission in the room.
!automod mute noisyuser 10m
!automod kick alice
!automod ban bob 1h
!automod unmute noisyuser
!automod unban bob
Duration looks like 30s, 10m, or 1h.
A number with no unit is minutes. Mute defaults to 5 minutes if you
omit it. Kick ignores duration. Ban is permanent unless you pass a
duration, in which case automod unbans when it runs out.
!automod wipe alice deletes Alice's messages in the
current room. !automod wipe with no name deletes every
message in that room. Private threads cannot be wiped.
Saved settings
The first time someone changes a setting in chat, automod writes a small JSON file next to the script. Filter toggles, extra words, and extra exempt users come back after a restart. Strikes and the 5 minute unmute timer do not. Those live only in memory and start over when the process stops. If automod restarts during a mute, a moderator can unmute by hand.
How to enable bot mode and write your own bot is on Bot accounts.