A playful Discord bot that sends random praises and (occasionally) a conspiracy theory — and cleans up after itself.
Warning
Discord updates frequently -- if any steps seem outdated, refer to the official docs: https://discord.com/developers/docs/intro
- Log into Discord.
- Go to Discord Developer Portal
- Click "New Application", give it a name, and create it.
- In the sidebar, go to Bot, click "Add Bot".
- Under OAuth2 > URL Generator:
- Select "bot" scope.
- Under Bot Permissions, check at least:
- Send Messages
- Use the generated URL to invite the bot to your server.
- In the Bot tab, click "Reset Token", copy the token and save it in your
.env
(view next step).
Create a .env
file in the root of your project with the following keys:
-
DISCORD_BOT_TOKEN
: Your bot token from the Discord developer portal. -
DISCORD_CHANNEL_ID
: The ID of the channel where the bot should send messages. -
SEND_MESSAGE_INTERVAL_MIN
: Minimum interval between messages (as an integer). -
SEND_MESSAGE_INTERVAL_MAX
: Maximum interval between messages (as an integer). -
SEND_MESSAGE_UNIT
: Time unit for the interval. Acceptable values: "second", "seconds", "minute", "minutes", "millisecond", "milliseconds". -
DELETE_CONSPIRACY_DELAY
: Time to wait before deleting a conspiracy message. Use Go duration format (eg "3s", "500ms", "1m"). -
CONSPIRACY_PROBABILITY
: Probability (from 0.0 to 1.0) that a conspiracy message is sent after a praise. Eg, 0.4 = 40% chance.
Optional:
PRAISE_INDEX
: Index of the praises.json to start from, useful when resuming bot.CONSPIRACY_INDEX
: Index of the conspiracies.json to start from, useful when resuming bot.
You can view the .env.sample as an example completed template.
- Install Go via https://go.dev/doc/install
- Install Make if you don't have it via https://www.gnu.org/software/make/
- Run:
make # builds the bot ./bin/bot # starts the bot
We maintain a ghcr image at ghcr.io/the-programmers-hangout/swiftspiracy-bot:latest
- Pull the image:
docker pull ghcr.io/the-programmers-hangout/swiftspiracy-bot:latest
- Run it with your
.env
file:docker run --env-file ./.env ghcr.io/the-programmers-hangout/swiftspiracy-bot:latest
- The bot gracefully shuts down on CTRL+C.
- Conspiracy messages are deleted after a short delay to keep the mystery alive, you should configure it to be low.
- Messages are sourced from praises.json and conspiracies.json. If your timings for message are too short for the duration the bot runs, the messages will repeat.