A secondary discord bot for the Czech SCP branch (alongside Thorn)
- Forwards Wikidot site applications to the server and allows responding to them directly on Discord
- Detects spam bots / hacked accounts and puts them in timeout until a moderator has the chance to respond, logs incidents
- Runs a Lost inspired minigame to keep you up at night
- Reposts popular messages to a Starboard channel
- Allows users to send anonymous confessions or reports to moderators
- More features are work-in-progress
-
Set up a discord developer account, create a bot and invite it to your server
-
Clone the repo
git clone https://github.com/x10102/monika.git cd monika -
Create a
config.jsonfile with the following contents:{ "bot_token": "<YOUR BOT TOKEN>", "log_file": "log.txt", "db_file": "monika.db", "roles": { "admin": <ADMIN ROLE ID> }, "channels": { "console": <CONSOLE CHANNEL ID> } }This is the basic setup required to start the bot and load the
BasicCommandsmodule, everything after that can be configured using the appropriate slash commands.The admin role should be your server's equivalent of an administrator or moderator. Keep in mind that most sensitive commands do not strictly require this role, just Discord's
Administratorpermission. -
You can now choose to either run the bot in a Docker container or directly using your Python environment. If you're familiar with Docker, it is recommended to use it.
- Create virtual environment, activate it and install requirements
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
Important
If you require the /reload command to restart the bot directly from Discord, make sure to run reloader.py instead of main.py
- Run the reloader script
python3 reloader.py
- Build the Docker image
docker build --tag monika .
Important
Be sure to mount the database file to a persistent volume or bind mount to prevent a data loss after updating or removing the container
- Create a container
# Touch the files on host to make them mount correctly touch /opt/monika/monika.db touch /opt/monika/log.txt docker run --detach --name monika_bot\ --volume type=bind,src=/opt/monika/monika.db,dst=/app/monika.db\ --volume type=bind,src=/opt/monika/log.txt,dst=/app/log.txt
- Make sure the bot is alive with
/ping, it should respond with a 🐈 - Use
/reloadto restart the bot after making changes to the configuration - If a new module is enabled, use
/synccommandsto make the bot synchronize the new commands with Discord. Users may have to restart their client to see them at first.- Modules such as
StarboardorConfessionsare loaded dynamically based on the configuration values (not) present
- Modules such as
- If the bot ever goes insane, use
/killto immediately exit/crash the script - Use
/configand/setconfigto view and change values in the config file- Each module only shows specific, non-sensitive values in its config report, passwords and similar settings are hidden from this command
- Certain values, such as the database path and bot token are also protected from being changed using
/setconfig, and must be directly written into the configuration file
- Use
/statsto see statistics reported by each module, not all of them may provide a lot of useful info - Use
/sayto make the bot say freaky things in public channels
- A "Starboard" is a channel where messages which gather enough reactions from members are reposted
- Create a starboard channel and set
channels.starboardto its ID - Insert a list of the reactions you want to use for this into
starboard.emoji- You can create a list with the
/setconfigcommand like this:VALUE1,VALUE2,VALUE3 - Built-in Discord emoji can be pasted in as-is, custom server emojis are formatted as
<:NAME:ID>
- You can create a list with the
- Finally, set
starboard.thresholdto the reaction count threshold which will cause a message to be pinned on the starboard
- This is enabled by default, set
overrides.disable_antispamtotrueto disable it - By default,
4identical messages within5minutes will trigger a spam event and mute the user for12hours. Useantispam.window_size,antispam.window_minutesandantispam.timeout_hoursrespectively to customize these values. - When a spam event is detected, a message will be sent to your console channel with details regarding the incident, along with the options to remove the timeout, delete the messages, or kick the user from the server.
- Set
wikidot.nameto the name of your wiki. For examplescp-wikiorwanderers-libraryfor the official SCP wikis. - Set
wikidot.userandwikidot.passwordto the credentials of a Wikidot user who has administrator rights on your wiki.- Make sure no one else can read your config file while you're at it
- Also keep in mind that this can't be read through any command, but can be changed by administrators. If this is a problem for you, check
constants.pyand you should be able to figure out how to protect specific config keys
- By default, the bot checks for new applications every 30 minutes. The check can also be triggered manually using
/applications - Once an application is received, it will be forwarded to your console channel with an option to either reject or accept it
- This one is simple, set
channels.confessionsto one of your admin channels. Users will then be able to use the/confesscommand to send you a message to that channel. - The users have an option for their name to be sent as well, or for the confession to remain anonymous. The usernames of users confessing anonymously will be redacted from the bot's logs as well.
WIP
WIP
WIP