This bot translates messages to various languages using the !translate <language_code> <message>
command.
Built with Python, Discord.py, and Googletrans.
- Translates text to different languages
- Simple command-based usage
-
Clone the repository.
-
Install dependencies:
pip install discord.py googletrans==4.0.0-rc1 python-dotenv
-
Create a
.env
file and add your Discord bot token:DISCORD_TOKEN=your_discord_bot_token
-
Run the bot:
python bot.py
Use the !translate
command followed by the language code and the message you want to translate.
Example:
!translate es Hello, how are you?
This will translate the text to Spanish.
Here is a list of common language codes you can use with the bot:
- en: English
- es: Spanish
- fr: French
- de: German
- it: Italian
- pt: Portuguese
- zh-cn: Chinese (Simplified)
- zh-tw: Chinese (Traditional)
- ja: Japanese
- ko: Korean
- ru: Russian
- ar: Arabic
- hi: Hindi
- bn: Bengali
- he: Hebrew
- id: Indonesian
- tr: Turkish
- vi: Vietnamese
- th: Thai
- pl: Polish
For a complete list of language codes, you can refer to the Googletrans documentation.
- Python 3.6 or higher
- discord.py
- googletrans==4.0.0-rc1
- python-dotenv