Overview
The Discord integration allows AIRI to join voice channels, listen to users, transcribe speech, and respond with both text and voice. It supports slash commands, mentions, and direct messages.Features
- Voice Channel Support: Join voice channels and participate in conversations
- Speech-to-Text: Automatically transcribe user voice input
- Text-to-Speech: Respond with natural-sounding voice
- Slash Commands: Interactive commands like
/summonand/ping - Text Chat: Respond to mentions and DMs
- Multi-Guild Support: Work across multiple Discord servers simultaneously
Prerequisites
- Node.js 18 or higher
- A Discord bot token
- OpenAI API key (for LLM and transcription)
- ElevenLabs API key (for TTS)
- AIRI server runtime running
Setup
1. Create Discord Bot
- Go to Discord Developer Portal
- Click New Application
- Go to Bot section and click Add Bot
- Enable these Privileged Gateway Intents:
- Server Members Intent
- Message Content Intent
- Copy your Bot Token
- Copy your Application ID (from General Information)
2. Invite Bot to Server
Use this URL, replacingYOUR_CLIENT_ID with your Application ID:
- Read Messages/View Channels
- Send Messages
- Connect to Voice
- Speak in Voice
- Use Voice Activity
3. Configure Environment
Navigate to the Discord bot service:.env.local:
4. Install Dependencies
From the project root:5. Start the Bot
Usage
Voice Commands
- Join a voice channel
- Use the
/summoncommand in any text channel - AIRI will join your voice channel
- Start speaking - AIRI will transcribe and respond
AIRI uses Voice Activity Detection (VAD) to automatically detect when users are speaking.
Text Commands
Slash Commands:/ping- Check if the bot is responsive/summon- Invite AIRI to your current voice channel
Code Examples
Basic Adapter Setup
Fromservices/discord-bot/src/adapters/airi-adapter.ts:55:
Sending User Input to AIRI
Fromservices/discord-bot/src/adapters/airi-adapter.ts:261:
Receiving Responses from AIRI
Fromservices/discord-bot/src/adapters/airi-adapter.ts:159:
Voice Channel Integration
Fromservices/discord-bot/src/bots/discord/commands/summon.ts:157:
Configuration
Dynamic Reconfiguration
The Discord bot supports runtime configuration updates via themodule:configure event:
Voice Settings
- Sample Rate: 48000 Hz (Opus)
- Channels: Stereo
- Transcription: OpenAI Whisper
- TTS: ElevenLabs
Troubleshooting
Bot is not responding
- Check the bot is online in Discord
- Verify the bot has permissions in the channel
- Check logs for connection errors
Voice not working
- Ensure you have
ELEVENLABS_API_KEYconfigured - Verify the bot has “Connect” and “Speak” permissions
- Check that voice gateway is connected in logs
Commands not showing
- Commands are registered when the bot starts
- Wait a few minutes for Discord to sync
- Try reinviting the bot with the correct scope
Next Steps
Configure Voice Settings
Customize voice and transcription settings
Telegram Integration
Add AIRI to Telegram
