A simple Discord bot that joins your voice channel and reads messages aloud.
| Command | Description |
|---|---|
!say <text> |
Bot joins your voice channel and speaks the text |
!stop |
Stops current playback |
!leave |
Bot disconnects from voice |
- Python 3.9+
- FFmpeg installed on your system:
- Mac:
brew install ffmpeg - Linux:
sudo apt install ffmpeg - Windows: Download from https://ffmpeg.org/download.html and add to PATH
- Mac:
- Go to https://discord.com/developers/applications
- Click New Application, give it a name
- Go to Bot → click Add Bot
- Under Privileged Gateway Intents, enable:
- ✅ Message Content Intent
- ✅ Server Members Intent (optional)
- Copy your Bot Token — you'll need it next
- Go to OAuth2 → URL Generator:
- Scopes:
bot - Bot Permissions:
Send Messages,Connect,Speak,Use Voice Activity
- Scopes:
- Copy the generated URL and open it to invite the bot to your server
# Clone / copy the files, then:
cd discord-tts-bot
# Install dependencies
pip install -r requirements.txt
# Set your bot token (Mac/Linux)
export DISCORD_TOKEN="your-token-here"
# Set your bot token (Windows PowerShell)
$env:DISCORD_TOKEN="your-token-here"
# Run the bot
python bot.py- Join a voice channel in your Discord server
- In any text channel, type:
!say Hello, this is a test! - The bot will join your voice channel and speak 🎉
- Change prefix: Edit
PREFIX = "!"inbot.py - Change language/accent: Edit
lang="en"in thegTTS(...)call. Examples:"en-uk"— British English"fr"— French"es"— Spanish- Full list: https://gtts.readthedocs.io/en/latest/module.html#languages-gtts-lang
- Auto-disconnect after speaking: Uncomment the two lines in the
after_playfunction
- "FFmpeg not found" — Make sure FFmpeg is installed and in your PATH
- Bot doesn't respond — Check that Message Content Intent is enabled in the Developer Portal
- No audio — Make sure the bot has
ConnectandSpeakpermissions in your voice channel