-
Notifications
You must be signed in to change notification settings - Fork 7
Home
Mitchell edited this page Jan 4, 2022
·
5 revisions
Welcome to the TranslatorDiscordBot wiki!
See https://discordpy.readthedocs.io/en/latest/api.html?highlight=reply# for Discord.py details
Credit to Wade Bourne (replit: @AllAwesome497) for the Discord bot replit template/starter code for the project.
Current Features:
- Japanese to English Translation
- User enters command into Discord chat: !translate [Japanese text]
- Bot parses Japanese text & sends request to DeepL API for translation
- Bot parses English translation from DeepL API response
- Bot replies to user: [Translated English text]
- English to Japanese Translation
- !translate function will check if the given string is able to be encoded as ASCII (covering English letters & most common special characters).
- Fixed previous issue, by changing alphanumeric check to ASCII check - Japanese is considered alphanumeric by python.
- Known issue: Due to this method of checking language, input containing emojis is automatically considered Japanese.
- If so, source & target language headers will change to EN and JP respectively, before the API call.
- Bot will return Japanese translation of entered English text
- !translate function will check if the given string is able to be encoded as ASCII (covering English letters & most common special characters).
- Translation via reply
- User replies to Japanese message with: !translate
- Bot parses Japanese text from the original message & translates to English
Potential Improvements:
- Private Translation
- To reduce clutter and increase user privacy, integrate !translate as a "slash command" (which is hidden from Discord chat)
- Rather than publicly replying, Bot returns translation as a server notification for the user who entered the command
- Roadblocks: Discord.py does not support "slash commands", may need to switch to a different Discord library
- Pronunciation Lookup
- Forvo API Integration
- User enters command: !pronounce [Japanese word]
- Bot sends request to Forvo API
- Bot returns pronunciation audio to the Discord chat
- Drawbacks: Pronunciation audio limited to single words & common phrases; Impossible to integrate with "Private Translation"