packages/examples/discord/README.md
Full-featured TypeScript Discord AI agent using elizaOS.
/ping, /about, /help)# Install all dependencies
bun install
bun run build
cd packages/examples/discord
cp env.example .env
# Edit .env with your credentials
Required variables:
DISCORD_APPLICATION_ID - Your Discord application IDDISCORD_API_TOKEN - Your bot tokenOPENAI_API_KEY - Your OpenAI API keycd packages/examples/discord
bun install
bun run start
# or for development with hot reload:
bun run dev
packages/examples/discord/
āāā env.example # Environment template
āāā README.md # This file
āāā agent.ts # Main entry point
āāā character.ts # Bot personality
āāā handlers.ts # Event handlers
āāā package.json
āāā tsconfig.json
Edit character.ts.
Edit handlers.ts to add new slash commands.
Configure bot behavior in the character settings:
{
"discord": {
"shouldIgnoreBotMessages": true,
"shouldRespondOnlyToMentions": true
}
}
| Command | Description |
|---|---|
/ping | Check if the bot is online |
/about | Learn about the bot |
/help | Show available commands |
cd packages/examples/discord
bun run test
DISCORD_API_TOKEN is correctThis example can work alongside the Telegram example. Both share the same .env file and can run simultaneously for a multi-platform bot experience.
# Run Discord bot
cd packages/examples/discord && bun start &
# Run Telegram bot (in another terminal)
cd packages/examples/telegram && bun start &
MIT