Skip to content
Dashboard
DocsBuild and deploy

Discord bots

Deploy a Go Discord Gateway bot with appropriate permissions, a protected token, and predictable command registration.

Create an application in the Discord Developer Portal, configure its bot user, and obtain the token. Add DISCORD_BOT_TOKEN to Deplexo environment variables. Read the starter README for additional application or development guild identifiers it requires.

Invite the bot using the bot and applications.commands scopes with only the permissions it needs. Slash commands can avoid reading arbitrary message content; enable privileged intents only when the bot’s behavior requires them.

A DiscordGo Gateway bot maintains an outgoing connection to Discord. Supply its credentials and deploy the Dockerfile. It does not require a public website or a custom domain.

Use a single active instance for the starter. If introducing sharding or multiple consumers, implement Discord’s session limits and shard coordination before scaling. Stop the local bot when it shares production credentials.

framework: dockerfile
dockerfile: Dockerfile

Watch runtime logs for the ready event, then invoke the starter’s slash command in a server where you installed the application. Test server-specific commands during development when supported by the starter; global command availability can take time to update.

If commands do not appear, check the application ID, installation scopes, guild ID, registration errors, and permissions. If the bot connects but cannot perform an action, check its effective channel permissions as well as role permissions.

Close the Gateway session on termination and allow the client to reconnect after network interruptions. A command handler should acknowledge interactions promptly and defer longer work using Discord’s interaction APIs.

Treat registration as a controlled operation: update the commands the application owns and avoid deleting unrelated commands. Persist important state outside process memory, and redact tokens and private message content from logs.

Check the bot rather than its assigned URL

Section titled “Check the bot rather than its assigned URL”

Deplexo currently performs a port check for all applications. A polling or Gateway bot has no HTTP listener, so startup may include a port warning before completing. Confirm that the bot responds in your test chat or server and inspect its logs. Do not add a dummy HTTP server just to make the assigned URL load.