A Discord bot that can join voice channels, listen to users, and respond using Gemini Live Native Audio.
- ✅ Join voice channels with
/joincommand - ✅ Leave voice channels with
/leavecommand - ✅ AI voice agent integration using Gemini Live Native Audio
-
Node.js (v16.9.0 or higher)
-
A Discord Bot Token
- Go to Discord Developer Portal
- Create a new application
- Go to "Bot" section and create a bot
- Copy the token
- Enable these Privileged Gateway Intents:
- Presence Intent
- Server Members Intent
- Message Content Intent
-
Bot Permissions
- When inviting the bot, make sure it has these permissions:
- Connect (voice)
- Speak (voice)
- Use Voice Activity
- Send Messages
- Use Slash Commands
- When inviting the bot, make sure it has these permissions:
-
Clone this repository
-
Install dependencies:
npm install
-
Set up your bot token:
create a .env file based on .env.example
-
Run the bot:
npm start
- Invite the bot to your Discord server
- Join a voice channel
- Use
/jointo make the bot join your channel - Start speaking - the bot will repeat what you say!
- Use
/leaveto make the bot leave the channel
# Run in development mode with auto-reload
npm run dev
# Build TypeScript
npm run build
# Run compiled JavaScript
npm run start:prod- Voice Connection: Uses
@discordjs/voiceto connect to Discord voice channels - Audio Receiving: Listens to user audio streams using Discord's voice receiver
- Audio Playback: Captures audio data and plays it back through the same connection
- Execution Flow: Discord Opus (48k stereo) → Opus Decoder → PCM 48k stereo → Downmix (stereo → mono) → PCM 48k mono → Downsample (48k → 16k) → PCM 16k mono → Gemini Live → PCM 24k mono → Upsample (24k → 48k) → PCM 48k mono → Upmix (mono → stereo) → PCM 48k stereo → Opus Encoder → Discord Voice
- Integrate AI voice assistant (Gemini)
- Add audio processing/filtering
- Support multiple simultaneous speakers
- Add voice command recognition
- Implement audio quality settings