This project provides a Discord bot that announces users joining and leaving voice channels using text-to-speech (TTS), along with a web interface for easy management.
- Voice Announcements: Announces when users join or leave voice channels
- Custom Announcements: Configure custom messages for specific users
- Whitelist Mode: Option to only announce specific users
- Multiple Language Support: TTS in various languages
- Web Interface: Easy-to-use web dashboard for configuration
- Docker Integration: Simple deployment with Docker
- Docker and Docker Compose installed
- A Discord bot token (Create a Discord Bot)
- Clone this repository
- Run the PowerShell setup script:
.\install.ps1
- Enter your Discord bot token when prompted
- Clone this repository
- Run the bash setup script:
chmod +x setup.sh ./setup.sh
- Enter your Discord bot token when prompted
- Copy
.env.example
to.env
- Edit
.env
and add your Discord bot token - Create the data directory:
mkdir -p data
- Run the containers:
docker-compose up -d
Once the containers are running, you can access the web interface at:
http://localhost:5000
From here, you can:
- Configure environment variables
- Manage custom announcements
- Set up the whitelist
- Restart the bot when needed
The following environment variables can be configured in the .env
file or through the web interface:
Variable | Description | Default |
---|---|---|
DISCORD_TOKEN |
Your Discord bot token | (Required) |
VOICE_LANGUAGE |
Language for TTS announcements | en |
COMMAND_PREFIX |
Prefix for bot commands | ! |
ANNOUNCE_JOINS |
Whether to announce users joining | True |
ANNOUNCE_LEAVES |
Whether to announce users leaving | True |
WHITELIST_MODE |
Whether to only announce whitelisted users | False |
TZ |
Timezone | UTC |
The bot supports the following Discord commands:
!announce [name]
- Test the announcement system!status
- Show bot status and configuration!togglejoins
- Toggle join announcements on/off!toggleleaves
- Toggle leave announcements on/off!togglewhitelist
- Toggle whitelist mode on/off!whitelist add @user
- Add a user to the whitelist!whitelist remove @user
- Remove a user from the whitelist!whitelist list
- List all users in the whitelist!addcustom @user join/leave [message]
- Add a custom message for a user!removecustom @user join/leave/both
- Remove custom message(s) for a user!listcustom
- List all custom announcements
For issues or questions, please open an issue on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.
A Discord bot that announces users joining and leaving voice channels using Text-to-Speech (TTS) technology, optimized for deployment on Unraid servers.
- 🎙️ Voice channel join announcements using TTS
- 🎠Voice channel join and leave announcements with toggle options
- 🎯 Custom announcements for specific users
- đź“‹ Whitelist mode to announce only specific users
- 🤖 Automatic voice channel connection management
- 🔊 Clear audio announcements using Google Text-to-Speech
- ⚙️ Configurable language and command prefix
- 🔍 Status command to monitor bot activity
- Unraid server with Docker enabled
- Discord bot token (How to get one)
- Community Applications plugin (optional but recommende## Detailed Unraid Installation
The easiest way to install on Unraid is through Community Applications:
- Make sure you have the Community Applications plugin installed on your Unraid server
- Search for "Discord Voice Announcer" in the Apps tab
- Click "Install"
- Configure the container:
- Enter your Discord bot token
- Set your timezone
- Adjust any other optional parameters
- Click "Apply" to create and start the container
If you prefer to set up the container manually:
- Navigate to the Docker tab in your Unraid web interface
- Click "Add Container"
- Configure the container with these settings:
- Repository:
disc0/discord-voice-announcer
- Name:
discord-voice-announcer
- Add the following Path:
- Config Type: Path
- Name: Data
- Container Path:
/app/data
- Host Path:
/mnt/user/appdata/discord-voice-announcer
- Add the following Variable:
- Config Type: Variable
- Name: DISCORD_TOKEN
- Key: DISCORD_TOKEN
- Value:
your_discord_bot_token
- Description### Creating a Discord Bot additional environment variables as needed (see Configuration Options section)
- Repository:
- Click "Apply" to create and start the container
Alternatively, you can use Docker Compose by creating a docker-compose.yml
file with:
version: '3'
services:
discord-voice-announcer:
image: disc0/discord-voice-announcer:latest
container_name: discord-voice-announcer
restart: unless-stopped
environment:
- DISCORD_TOKEN=your_discord_bot_token_here
- TZ=Europe/London
- VOICE_LANGUAGE=en
- COMMAND_PREFIX=!
- ANNOUNCE_JOINS=True
- ANNOUNCE_LEAVES=True
- WHITELIST_MODE=False
volumes:
- /mnt/user/appdata/discord-voice-announcer:/app/data
And then run:
docker-compose up -d
- The bot's data will be stored in
/mnt/user/appdata/discord-voice-announcer
on your Unraid server - Custom announcements and whitelist configurations will persist across container restarts and updates
- The container logs can be viewed from the Docker tab by clicking on the container name
- For troubleshooting, view the logs with either:
- The Unraid web interface (Docker tab > Container Logs)
- The terminal command
docker logs discord-voice-announcer
- Go to the Discord Developer Portal.
- Click "New Application" and give it a name.
- Navigate to the "Bot" tab and click "Add Bot".
- Under the "Privileged Gateway Intents" section, enable:
- Presence Intent
- Server Members Intent
- Message Content Intent
- Save your changes.
- Under the "TOKEN" section, click "Copy" to copy your bot's token.
- IMPORTANT: Keep this token secret! It's like a password for your bot.
- In the Developer Portal, go to the "OAuth2" > "URL Generator" tab.
- Under "Scopes", select "bot".
- Under "Bot Permissions", select:
- View Channels
- Send Messages
- Connect
- Speak
- Copy the generated URL and open it in your browser.
- Select your server and authorize the bot.
If you prefer to run the bot without Docker, follow these steps:
- Download the FFmpeg build from ffmpeg.org or use a package manager like Chocolatey.
- Add FFmpeg to your system PATH.
- Verify the installation by running
ffmpeg -version
in your terminal.
sudo apt update
sudo apt install ffmpeg
brew install ffmpeg
-
Clone this repository:
git clone https://github.com/Disc0-0/discord-voice-announcer-unraid.git cd discord-voice-announcer-unraid
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- Windows:
.\venv\Scripts\Activate.ps1
(PowerShell) or.\venv\Scripts\activate.bat
(Command Prompt) - Linux/macOS:
source venv/bin/activate
- Windows:
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.env
file with your Discord bot token:DISCORD_TOKEN=your_discord_bot_token_here VOICE_LANGUAGE=en COMMAND_PREFIX=! ANNOUNCE_JOINS=True ANNOUNCE_LEAVES=True WHITELIST_MODE=False
-
Start the bot:
python main.py
Once the bot is running and has joined your server, it will automatically join voice channels when someone enters and announce their arrival.
The bot responds to the following commands:
!announce [message]
- Test the announcement system with an optional custom message!status
- Display information about the bot's current status and configuration!togglejoins
- Toggle whether the bot announces when users join voice channels!toggleleaves
- Toggle whether the bot announces when users leave voice channels!togglewhitelist
- Toggle between announcing all users or only whitelisted users!whitelist add @user
- Add a user to the announcement whitelist!whitelist remove @user
- Remove a user from the announcement whitelist!whitelist list
- List all users in the announcement whitelist!addcustom @user join|leave message
- Add a custom announcement message for a specific user!removecustom @user join|leave|both
- Remove custom announcement message(s) for a specific user!listcustom
- List all custom announcement messages
You can modify the following options in the .env
file:
# Your Discord bot token (required)
DISCORD_TOKEN=your_discord_bot_token_here
# Language for TTS announcements (default: en)
VOICE_LANGUAGE=en
# Command prefix (default: !)
COMMAND_PREFIX=!
# Whether to announce when users join channels (default: True)
ANNOUNCE_JOINS=True
# Whether to announce when users leave channels (default: True)
ANNOUNCE_LEAVES=True
# Whether to only announce whitelisted users (default: False)
WHITELIST_MODE=False
The bot supports custom personalized announcements for specific users. This feature allows you to set unique messages that play when certain users join or leave voice channels.
Custom announcements are stored in the custom_announcements.json
file, but the recommended way to manage them is through bot commands.
To add a custom announcement for a user:
!addcustom @Username join The legendary {username} has arrived!
Or for leave announcements:
!addcustom @Username leave {username} has vanished into thin air!
The {username}
placeholder will be replaced with the user's display name.
To remove custom announcements for a user:
!removecustom @Username join # Remove just the join message
!removecustom @Username leave # Remove just the leave message
!removecustom @Username both # Remove both join and leave messages
To see all custom announcements:
!listcustom
- Special announcements for administrators
- Fun custom messages for friends
- Themed announcements for special events
- Different styles for different channels or games
- Custom announcements require administrator permissions to manage
- The
custom_announcements.json
file updates automatically - You can use the same
{username}
placeholder multiple times in a message
The bot supports a whitelist mode that allows you to specify exactly which users should trigger voice announcements. When enabled, only users in the whitelist will generate join/leave announcements.
Whitelist settings are stored in the announcement_whitelist.json
file, but the recommended way to manage the whitelist is through bot commands.
To toggle whitelist mode on or off:
!togglewhitelist
When enabled, only users in the whitelist will trigger announcements. When disabled, all users will trigger announcements as usual (subject to the join/leave announcement toggles).
To add a user to the whitelist:
!whitelist add @Username
To remove a user from the whitelist:
!whitelist remove @Username
To see all users in the whitelist:
!whitelist list
Whitelist mode and custom announcements can be used together. When both are enabled:
- Only whitelisted users will trigger announcements
- If a whitelisted user also has a custom announcement, their custom message will be used
- If a user is not in the whitelist, they won't trigger any announcements even if they have custom messages
- Announce only for specific team members or administrators
- Limit announcements to main players in a gaming channel
- Reduce announcement frequency in busy servers
- Prevent announcement spam from users who frequently join/leave
- Requires administrator permissions to manage
- The whitelist is saved between bot restarts
- You can combine whitelist mode with custom announcements for maximum flexibility
- When whitelist mode is enabled but your whitelist is empty, no announcements will be made
- Container keeps restarting: Check the logs for error messages, particularly related to the Discord token
- TTS not working: The container includes FFmpeg, no additional installation is needed
- Data not persisting: Check the volume mapping and permissions on your host path
- Invalid token error: Verify your token in the container environment variables
- Cannot find whitelist/custom announcements: Ensure the data volume is properly mounted
- Permission issues: Try adjusting the PUID/PGID environment variables to match your Unraid user
- Bot not connecting to voice channels: Ensure FFmpeg is properly installed (only for non-Docker installations)
- No sound playing: Check that your bot has the "Speak" permission in your Discord server
- Bot disconnecting immediately: This may happen if the voice channel is empty or if there are connection issues
The Discord Voice Announcer now includes a web interface for easy management of your bot settings. This provides a user-friendly way to configure the bot without using Discord commands.
- Environment Configuration: Edit bot settings like language, command prefix, etc.
- Custom Announcements Management: Add, edit, and remove custom announcements
- Whitelist Control: Manage the whitelist of users in a simple interface
- Bot Controls: Restart the bot when needed directly from the interface
Once running, the web interface is available at:
http://your-server-ip:5000
The web interface is included in the docker-compose setup and will automatically be deployed when you follow the installation instructions above.
For manual configuration, the web interface requires:
- Proper volume mapping to access the same data as the bot
- Access to the Docker socket to control the bot container
- Network connectivity to the bot container
The docker-compose.yml
file includes all necessary configuration for the web interface to work properly.
- Clone this repository to your server
- Edit the
.env
file and change the following:- Replace
your_discord_bot_token_here
with your Discord bot token - (Optional) Change the timezone (TZ) to match your location
- Replace
- Run
docker-compose up -d
to start both containers - Access the web interface at
http://your-server-ip:5000
- The web interface uses a random secret key for sessions
- For additional security, consider:
- Running behind a reverse proxy with authentication
- Using a firewall to restrict access to port 5000
- Using a VPN when accessing the interface remotely