Skip to main content

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 /summon and /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

  1. Go to Discord Developer Portal
  2. Click New Application
  3. Go to Bot section and click Add Bot
  4. Enable these Privileged Gateway Intents:
    • Server Members Intent
    • Message Content Intent
  5. Copy your Bot Token
  6. Copy your Application ID (from General Information)

2. Invite Bot to Server

Use this URL, replacing YOUR_CLIENT_ID with your Application ID:
Required Permissions:
  • Read Messages/View Channels
  • Send Messages
  • Connect to Voice
  • Speak in Voice
  • Use Voice Activity

3. Configure Environment

Navigate to the Discord bot service:
Edit .env.local:

4. Install Dependencies

From the project root:

5. Start the Bot

You should see:

Usage

Voice Commands

  1. Join a voice channel
  2. Use the /summon command in any text channel
  3. AIRI will join your voice channel
  4. 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
Mentions: Mention the bot in any channel:
Direct Messages: Send a DM to the bot - no mention required.

Code Examples

Basic Adapter Setup

From services/discord-bot/src/adapters/airi-adapter.ts:55:

Sending User Input to AIRI

From services/discord-bot/src/adapters/airi-adapter.ts:261:

Receiving Responses from AIRI

From services/discord-bot/src/adapters/airi-adapter.ts:159:

Voice Channel Integration

From services/discord-bot/src/bots/discord/commands/summon.ts:157:

Configuration

Dynamic Reconfiguration

The Discord bot supports runtime configuration updates via the module:configure event:

Voice Settings

  • Sample Rate: 48000 Hz (Opus)
  • Channels: Stereo
  • Transcription: OpenAI Whisper
  • TTS: ElevenLabs

Troubleshooting

Bot is not responding

  1. Check the bot is online in Discord
  2. Verify the bot has permissions in the channel
  3. Check logs for connection errors

Voice not working

  1. Ensure you have ELEVENLABS_API_KEY configured
  2. Verify the bot has “Connect” and “Speak” permissions
  3. Check that voice gateway is connected in logs

Commands not showing

  1. Commands are registered when the bot starts
  2. Wait a few minutes for Discord to sync
  3. Try reinviting the bot with the correct scope

Next Steps

Configure Voice Settings

Customize voice and transcription settings

Telegram Integration

Add AIRI to Telegram