5/10/2023 0 Comments Translate bot discord issueJapanese characters cannot be encoded with ASCII, so messages containing non-ASCII characters are sent to DeepL as Japanese to be translated into English (known issue: emojis. I later iterated upon the !translate function to have it automatically detect the source language by checking if the source text can be encoded with ASCII. Finally, I used a Discord.py function to have the bot reply the translated text to the user who used the "!translate" command. Using the python request module, I set up a function to send the text from the translate command, along with the source & target languages, to the DeepL translation API, which would return the translated text. I then implemented a translation command, which would parse any text following "!translate" at the beginning of a chat message. I started by creating a simple Discord bot using the Discord.py library, which made it quick to set up a bot to monitor chat messages, waiting for a command. ![]() My hope is that by giving members access to a convenient translation tool, beginners will feel less overwhelmed when peering into a chat room full of higher-level Japanese speakers, and more confident to join in the conversation. I thought back on these times as I wondered why the "Japanese-only" chat room was so inactive in a Japanese learning Discord server I'm in, and decided to make a bot to help make the chat more accessible to beginners. I didn't want to pester people by asking them what their sentences meant, but I also didn't want to copy+paste dozens of messages into Google Translate so I could follow the conversation. As someone who studied Japanese for 4 years, I remember being a beginner in the language, shying away from participating in "Japanese-only" chats, since there were many words I didn't understand. ![]() I created this bot for use on a Japanese learning Discord server. See wiki for details & additional feature plans/ideas. This functionality allows users to quickly look up words they don't know how to say in Japanese, translate words they don't understand into English, or translate entire phrases between the two languages - all without having to switch back & forth between a dictionary website and Discord. (The abbreviation "!tl" can also be used, in place of "!translate".) Users can enter "!translate " into the Discord chat to have their text translated, or reply to a message with "!translate" to have the message they replied to translated. This bot translates Discord chat messages from Japanese to English (and vice versa). Nice and simple.Discord Bot with Translation FunctionalityĬreated using the Discord.py python library for Discord chat integration, and DeepL's translation API. Where it identifies that it is not English text, detects the language, and then changes the text to English for me. So I was hoping there was some way that I could just have things automatically translate - similar to Google Chrome's Auto-Translate Page feature. Both methods include unnecessary steps, but the Desktop method is a huge pain in the ass. On Mobile, it is a lot easier, just highlighting and clicking copy then having a pop-up icon to one-click translate from (insert detected language) to (insert preferred language). Whereas currently, I am having to constantly have a Translation Tab open in my browser that I paste the copied messages I receive into, when on Desktop. With Google Translate (Mobile), if you have Tap To Translate enabled, if you select text and copy it to your clipboard, and then click either pop-up GTranslate Icon or the Tap To Translate Bar in the Notification Panel at the top, it will automatically detect the language and translate it to your preferred language. I am also pretty involved in many (related) servers where the primary languages are Russian, French, Polish, Czech, Russian, Ukrainian, Spanish, Italian, etc., etc. and it would be incredibly convenient to be able to have a feature similar to the "tap to translate" feature that the Google Translate uses on Mobile. ![]() If I have to communicate privately with any of them, I have to have a tab for translation open in my browser to read what they say and to half-assedly translate what I want to say. It is just so that the Czech members have the freedom to chat in their own language and not worry about having a bunch of English-speakers being annoying about it, and so that the English speakers can talk to each other with the others using second-hand English to chime in now and again. We have independent CZ and ENG chat channels, but everyone uses both. I am heavily involved in a server that is half Czech/Slovak, a quarter of misc Europeans, and roughly a quarter English-speakers.
0 Comments
Leave a Reply. |