Requirements
- A bot token from the Discord Developer Portal (create an application, add a Bot, copy the token).
- The Message Content privileged intent enabled for your bot in the Developer Portal (it is part of the default
intentsvalue below).
Configuration
Set under channels.discord in ~/.flowly/config.json:
{
"channels": {
"discord": {
"enabled": true,
"token": "...",
"allowFrom": [],
"gatewayUrl": "wss://gateway.discord.gg/?v=10&encoding=json",
"intents": 37377
}
}
}| Key | Type | Default | Description |
|---|---|---|---|
enabled | bool | false | Start the Discord adapter at gateway boot. |
token | string | "" | Bot token from the Discord Developer Portal. |
allowFrom | string[] | [] | Allowed user IDs. Empty = allow all. |
gatewayUrl | string | wss://gateway.discord.gg/?v=10&encoding=json | Discord Gateway WebSocket URL. |
intents | int | 37377 | Gateway intents bitfield (GUILDS + GUILD_MESSAGES + DIRECT_MESSAGES + MESSAGE_CONTENT). |
Connect method
The adapter opens the Discord Gateway WebSocket, sends IDENTIFY with your token and intents, and maintains a heartbeat. It handles HELLO, READY/MESSAGE_CREATE, RECONNECT, and INVALID_SESSION, and auto-reconnects with a 5-second backoff. Messages from bot authors are skipped; attachments up to 20 MB are downloaded to ~/.flowly/media. Outbound replies are sent via POST {API}/channels/{chat_id}/messages with Authorization: Bot <token>, with retry handling for rate limits.
Access control
allowFrom (allowed user IDs); an empty list allows everyone. It does not use the pairing store, so flowly pairing approve discord ... has no runtime effect on this adapter β manage access via the allowFrom list.
Setup steps
- In the Discord Developer Portal, create an application and add a Bot. Copy the token.
- Under the Bot settings, enable the Message Content privileged intent.
- Invite the bot to your server with the appropriate permissions.
- Set
channels.discord.enabledtotrueand paste thetoken. - Optionally restrict access by adding user IDs to
allowFrom. - Start the gateway:
flowly gateway.