Discord Setup
Overview
The Discord channel connects Anyy to Discord direct messages and servers. The adapter supports DMs, group/server conversations, thread context, inbound media, lifecycle startup, and live-smoke checks.
Anyy is still the assistant. Discord is only a surface for receiving messages and delivering replies.
Prerequisites
- A Discord application with a bot user.
- A bot token.
- The bot invited to the server or channels where it should answer.
- Gateway permissions for the bot to read messages and send messages.
- The bot user id, if you want Anyy to reliably ignore its own messages.
Setup
Create credentials
Create or reuse a Discord bot token in Discord's developer portal. Keep the token
out of config.yaml; Anyy stores it as a profile secret.
Configure Anyy
anyy setup channels discord \
--secret bot_token='discord-bot-token' \
--write-config
The helper writes a channels.discord block with these defaults:
| Field | Default |
|---|---|
account_id | work |
dm_policy | pairing |
group_policy | mention |
allow_from | [] |
allow_groups | [] |
media_max_bytes | 5242880 |
Add optional fields when needed:
channels:
discord:
bot_user_id: "1234567890"
send_chunk_chars: 3800
Start Gateway
anyy gateway start
anyy channels reload
Run doctor checks
anyy channels doctor discord
Doctor verifies config and secret references. It does not register Discord permissions for you.
Access Policy
Direct messages
The setup helper writes dm_policy: pairing. The first accepted DM can claim the
channel unless you change the policy.
Use allowlist when the bot is installed broadly:
channels:
discord:
dm_policy: allowlist
allow_from:
- "discord-user-id"
Groups
The default group_policy: mention means Anyy answers in Discord group or
server contexts only when it is mentioned. Use allow_groups with allowlist
when only specific channels should be accepted.
Admins
Discord channel policy controls message admission. Shared messaging command permissions control administrative commands.
Sessions
Anyy keeps separate sessions per accepted Discord conversation. Thread metadata is preserved when Discord sends thread information, so replies stay in the expected context.
Media Support
Inbound media
Discord advertises inbound media support. Anyy can receive supported
attachments up to media_max_bytes.
Outbound media
This adapter does not advertise native outbound media. Generated artifacts remain stored in the Anyy session.
Commands
Use the same messaging commands as other channels. In servers, mention the bot
when group_policy is mention.
Cron Delivery
Cron jobs can deliver to Discord when a default binding or delivery target is available:
anyy cron create \
--name "Discord summary" \
--schedule "0 9 * * *" \
--prompt "Post my morning summary" \
--delivery-target current_user_default \
--delivery-channel discord
Troubleshooting
- The bot is silent in a server: check
group_policy, bot mentions, and Discord channel permissions. - DM is rejected: check
dm_policyandallow_from. - Self-replies or loops: set
bot_user_id. - Attachments are ignored: confirm file size is below
media_max_bytes.