Discord
KhunQuant connects to Discord using the Discord Gateway (WebSocket). The DiscordChannel adapter listens for incoming messages and dispatches responses back to the originating channel or thread. No public URL is required — the connection is established outbound from your server.
Capabilities
- Text message send/receive
- Typing indicator (
TypingCapable) - Slash command registration (
CommandRegistrarCapable) - Allow-listing by Discord user ID
- Voice channel join/leave with audio transcription
- Media attachment transcription (audio files)
Configuration
Add to ~/.khunquant/config.json:
{
"channels": {
"discord": {
"enabled": true,
"token": "DISCORD_BOT_TOKEN",
"allow_from": ["123456789012345678"],
"group_trigger": {
"mention_only": true,
"prefixes": ["/ask"]
}
}
}
}
Store the bot token in ~/.khunquant/.security.yml:
channels:
discord:
token: "MTIzN..."
| Field | Type | Description |
|---|---|---|
enabled | bool | Enable the Discord channel |
token | SecureString | Bot token from the Discord Developer Portal |
allow_from | []string | Allowlist of Discord user IDs (empty allows all) |
group_trigger.mention_only | bool | Only respond when the bot is @mentioned in a server channel |
group_trigger.prefixes | []string | Additional keyword triggers (e.g. /ask, !bot) |
Setup steps
- Go to the Discord Developer Portal and create a new application.
- Navigate to Bot and click Add Bot — copy the bot token.
- Under Bot → Privileged Gateway Intents, enable Message Content Intent.
- Add the token to
.security.yml. - Enable Developer Mode in Discord (Settings → Advanced) and right-click your avatar to copy your User ID for
allow_from. - Use the OAuth2 URL Generator with the
botandapplications.commandsscopes plus Send Messages and Read Message History permissions to invite the bot to your server. - Start KhunQuant.
Voice channels
The bot can join a voice channel to transcribe audio in real time. Use these in-chat commands:
| Command | Description |
|---|---|
!vc join | Join the voice channel you are currently in |
!vc leave | Leave the current voice channel |
Voice transcription requires an ASR model to be configured. See the model configuration guide for details.
In direct messages the bot replies to every message. In server channels it defaults to responding only when @mentioned (mention_only: true). Adjust group_trigger to match your preferred behaviour.