memcode docs
Agents

Discord

Run your memcode agent from a Discord bot.

Memcode connects out to Discord, so the bot stays online and responds in real time, no public URL needed.

Step 1: Create a bot

In the Discord Developer Portal, create a New Application, open the Bot tab, and copy the bot token.

Step 2: Enable the Message Content intent

Still on the Bot tab, turn on the Message Content Intent. This is a privileged intent, and without it the bot receives empty message bodies and cannot see what people type.

Step 3: Invite the bot to your server

Under OAuth2 > URL Generator, select the bot scope and the permissions to read and send messages, then open the generated URL to add the bot to your server.

Step 4: Configure

memcode gateway setup

Choose discord, paste the bot token, and enter the Discord user ids allowed to drive the agent. The token is written to your global .env as DISCORD_BOT_TOKEN.

Step 5: Run

memcode gateway

from the project you want the agent to work in. In a DM the bot replies to every message; in a server channel it acts only when you @mention it or reply to one of its messages, so it does not run on ordinary chatter (set respond_to_all: true under the channel in gateway.yaml to change that). Long replies are split to respect Discord's per-message length limit.

On this page