A Discord bot that reads text commands and speaks in voice channels. The bot can:
- Speak a given message in a voice channel using the
!saycommand. - Automatically disconnect from the voice channel after 1 minute of inactivity, saying "Bye".
- Manually disconnect from the voice channel using the
!saynomorecommand, with the bot saying "Bye" before disconnecting.
- Python 3.7 or higher
- FFmpeg installed and added to your system PATH.
- Windows: Download from FFmpeg Downloads.
- macOS: Install via Homebrew:
brew install ffmpeg. - Linux: Install via package manager, e.g.,
sudo apt-get install ffmpeg.
-
Clone the repository:
git clone https://github.com/benrosiers/discord_voice_bot.git cd discord_voice_bot
2.Create and activate a virtual environment (recommended):
python -m venv venv
venv\Scripts\activate
source venv/bin/activate
3.Install the dependencies:
pip install -r requirements.txt
4.Set up the environment variables for your bot token and secret:
export BOT_TOKEN='your-bot-token-here' export BOT__SEC='your-bot-secret-here'
set BOT_TOKEN=your-bot-token-here set BOT__SEC=your-bot-secret-here
$env:BOT_TOKEN="your-bot-token-here" $env:BOT__SEC="your-bot-secret-here"
Important: Replace 'your-bot-token-here' and 'your-bot-secret-here' with your actual bot token and secret. Never share your bot token or secret publicly.
1.Run the bot:
python main.py
2.Use the bot in Discord:
In a text channel, type:
!say Hello, this is a test message.
The bot will join a voice channel according to the logic defined and speak the message.
If you wish to install the application as a package:
1.Build the package:
python setup.py sdist bdist_wheel
2.Install the package:
pip install dist/discord_voice_bot-0.1.0-py3-none-any.whl
3.Run the bot using the console script
discord-voice-bot
This project is licensed under the MIT License.
For any questions or issues, please contact Benoit Desrosiers at benoitdesrosiers1980@gmail.com.