Running the Bot


Starting the bot

With your virtual environment active and .env configured:

python -m bot.main

On a successful start you should see console output like:

Logged in as Verbal Warning Logger#1234 (ID: 123456789012345678)

First-run behavior

On the very first run, the bot automatically:

  • Creates warnings.db — SQLite database for verbal warnings

  • Creates staffpolls.db — SQLite database for polls and templates

  • Initializes all table schemas

  • Syncs slash commands globally with Discord

Global command sync can take up to an hour to propagate to all servers. Commands will appear in your server once Discord's cache updates.


Faster command sync during development

To make slash commands appear immediately in a single server (useful while testing), edit bot/main.py and replace the sync line in setup_hook:

Commands will appear in that guild within seconds. Remember to revert this change before deploying to production if you want the bot to work in multiple servers.


Keeping the bot running

For a production deployment you should run the bot as a background service so it survives terminal disconnects and server reboots.

systemd (Linux)

Create /etc/systemd/system/verbal-warning-logger.service:

Then enable and start it:

Check logs with:

pm2 (any platform)


Stopping the bot

Send Ctrl+C in the terminal, or if running as a service:


Troubleshooting

Symptom
Likely cause

KeyError: DISCORD_TOKEN

.env file is missing or not in the project root

Commands not appearing

Global sync is still propagating — wait up to 1 hour, or use guild sync

/auttaja commands missing

SUPABASE_URL / SUPABASE_KEY are not set

discord.errors.Forbidden

Bot is missing required permissions in the channel or server

Permission errors on /verbal

The user's highest role is below STAFF_ROLE_ID in the role list

Last updated

Was this helpful?