This is a simple Discord bot that listens for messages in a specific text channel and speaks them out loud in a voice channel using Google Text-to-Speech (gTTS).
- The bot connects to your Discord server.
- It watches for new messages in a text channel named
sergio. - When someone sends a message in that channel, the bot uses gTTS to convert the message to speech.
- It joins a voice channel called
generaland plays the audio.
-
Install requirements
Make sure you have Python installed, then run:pip install discord.py gTTS
-
Install FFmpeg
This bot uses FFmpeg to play audio. Download it here: https://ffmpeg.org/download.html
Make sure it's added to your system's PATH. -
Edit the bot token
Open the Python script and replace'YOUR_BOT_TOKEN'with your actual bot token. -
Run the bot
python your_script_name.py
- The bot only listens to messages in a channel called
sergio. You can change theTARGET_TEXT_CHANNEL_NAMEin the script if needed. - Likewise, it only joins a voice channel named
general. - The bot does not disconnect from the voice channel by default — you can uncomment the
disconnectline if you want it to leave after each message.