Eventually fully featured Discord Bot
Jump to Usage
Contributing
·
Report Bug
·
Request Feature
This is a Discord bot for a private server. This project is set up to allow any member of the server to contribute features to the bot and learn about development and DevOps together.
The bot is written in Typescript to be run on the Deno runtime.
- Database
- Logging
- Image spoiler enforcement
- Reaction roles
- Set up database
- Automatic bulk message deletion
- Starboard
- Button to remove automatic message replies
- Permission system for it
- Let boosters set their own colour
- Server emoji popularity tracking
See the open issues for a full list of proposed features (and known issues).
services:
bot:
# You can pin the version by using a semver tag e.g.:
# ghcr.io/emilyxfox/janitor-discord-bot:v0.3.1
image: ghcr.io/emilyxfox/janitor-discord-bot:latest
restart: unless-stopped
# This example uses an external .env file.
# The .env file will be read when you run docker compose up
# Environment variables can be defined directly here as well
environment:
DISCORD_TOKEN: ${DISCORD_TOKEN}
# You can use the service name instead of an IP
DB_URL: http://db:8080/
# You can choose to deploy commands to a list of guilds or globally
# The bot defaults to registering commands globally.
# If you want to deploy commands to a list of guilds...
DEPLOY_COMMANDS_TO: GUILDS
# ...you should specify them with this list syntax.
GUILDS: |-
1327443723425363754
1312443867846354378
# Bind the /app/logs/ directory to persist logs between container restarts.
volumes:
- ./logs:/app/logs
db:
image: ghcr.io/tursodatabase/libsql-server:latest
platform: linux/amd64
restart: unless-stopped
# Unless you need to access the DB from the host system
# you don't need to bind any ports.
# If you need this it might be a good idea to also configure auth.
#ports:
# - "8080:8080"
environment:
- SQLD_NODE=primary
volumes:
- ./data/libsql:/var/lib/sqld| Environment Variable | Description | Required / Default |
|---|---|---|
| DISCORD_TOKEN | The Discord bot token used for authentication. | Required |
| DEPLOY_COMMANDS_TO | Specifies the deployment target for commands. Accepts either GLOBAL or GUILDS (case insensitive). |
Optional, defaults to GLOBAL |
| GUILDS | A newline-separated (\n) list of guild IDs where commands will be deployed (if DEPLOY_COMMANDS_TO is set to GUILDS). |
Optional (no default) |
| LOG_LEVEL | Sets the log level to either DEBUG or INFO | Optional, defaults to DEBUG |
| DB_URL | The URL for connecting to the database. Must be a valid URL. | Required |
| DB_AUTH | Database authentication credentials (if needed). | Optional (no default) |
| DEV | Flag indicating development mode. Accepts "true" or "false" (case insensitive). |
Optional, defaults to false |
| REPO_URL | The URL of the repository. | Optional, defaults to this repository |
- Deno
- Windows:
irm https://deno.land/install.ps1 | iex
- Linux/Mac:
curl -fsSL https://deno.land/install.sh | sh - Discord bot token
- Go to the Discord Developer Portal and sign in.
- Open the Applications tab and create a new application.
- Enable "Presence Intent", "Server Members Intent", and "Message Content Intent" under Privileged Gateway Intents
- Reset the bot token.
- Docker for container development
- Install instructions for your OS can be found in the Docker documentation.
- Fork the repo
# Github CLI
gh repo fork EmilyxFox/janitor-discord-bot- Clone your fork
git clone https://github.com/{Your username}/janitor-discord-bot.git- Install dependencies
deno install- Make a copy of .env.example and fill the required variables
# Linux
cp ./.env.example ./.env# Windows
Copy-Item -Path ".\.env.example" -Destination ".\.env"- Run the bot
deno task devIf it bot detects that it is not in any guilds it will output an invite link to the console.
- Create a branch for your feature
git switch -c feat/my-cool-feature- Commit your changes
git commit -m "I added the coolest feature!"- Push your branch
git push origin feat/my-cool-feature