This is a Discord bot designed to help users translate messages in a server so that communities can accommodate users from different countries and languages.
The bot utilizes deep-translator to provide API-less translations while remaining accurate.
It can:
- Translate messages between languages
- Be plugged into existing bots
- Provide easy setup for beginners
- Create your own Discord bot through the Discord Developer Portal.
- Get your Discord API key.
- Create a
.envfile and put on the first line: (DISCORD_TOKEN = [Your Discord API key]) - Install requirements: (
pip3 install -r requirements.txt) to install the requiremnets - Run the bot: (
python3 -u Translation_Bot.py)
The bot works by watching for flag emojis to be placed under comments. The bot will create a thread under the comment that provides a transalation for the text. Currently the bot supports the following languages:
- English
- Spanish
- Japanese
- Chinese Mandarin
- French
- Tagalog
- Hindi
- Thai
- Arabic
- Bengali
- Portugese
- Russian
- Indonesian
To show all available languages, use the command "!languages" within discord and it will also give you the appropriate flags.
To expand it to your needs, modify the JSON file with the flag unicode of the nation, the ISO 639-1 language code, and the name of the language itself.
For Example:
({ "flag": "🇬🇧", "code": "en", "name": "English" })
- Copy over the files
- translatorFunctions.py
- utils.py
- languages.json
- Install the deep-translator python library and add it to your requirements.txt
- create an event that calls the
handle_reaction_transaltionfunction