![discord auto translate bot discord auto translate bot](https://images.discordapp.net/avatars/471542070817849355/fb3fd7048fdcaafd56f8f278e2e74bae.png)
Return (await JsonSerializer.DeserializeAsync(result)).FirstOrDefault() Ĭongratulation, you have successfully created a language translation bot! HttpResponseMessage response = await client.SendAsync(request).ConfigureAwait(false) ("Ocp-Apim-Subscription-Key", subscriptionKey) Request.Content = new StringContent(requestBody, Encoding.UTF8, "application/json") Request.RequestUri = new Uri(endpoint + route) Using (var request = new HttpRequestMessage()) Var requestBody = JsonSerializer.Serialize(body) Your secrets.json will look something like the following. I created a Models/Config directory and added a TranslatorConfig class there. Start by binding the required Azure Translator configuration options to a POCO class. This will allow you to easily migration to a production environment using something like Azure Key Vault. services.AddTransient() įor this tutorial, we will use Visual Studio's Secret Manager in our development environment.
![discord auto translate bot discord auto translate bot](https://fiverr-res.cloudinary.com/images/t_main1,q_auto,f_auto,q_auto,f_auto/gigs/143031293/original/811d97a1ae94a82b23cf77a5a85c8b18bc217950/create-discord-bots-in-javascript.png)
Now, in Startup.cs, be sure your project is configured to launch the TranslateBot instead of the previously configured EchoBot. Protected override async Task OnMembersAddedAsync(IList membersAdded, ITurnContext turnContext, CancellationToken cancellationToken) Protected override async Task OnMessageActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken) public class TranslateBot : ActivityHandler Rename the EchoBot.cs class under the Bots folder and call it TranslateBot.cs. Now in Visual Studio, create a new Echo Bot project like you did in the the previous tutorial, except this time we will build off of the scaffolded project. Once your Cognitive Services Text Translation endpoint has been created, navigate to it in the Azure Portal and locate your secret keys. For helping signing up for the Microsoft Translator service in Azure, follow the MS Docs guide. Getting Startedįor this tutorial, you will need an active Azure subscription, as we will be relying on the Microsoft Translator service. In this tutorial, you will take your bot to the next level by creating something useful - a bot that will translate language. The example was fairly trivial, as the bot simply echoed the input of the user. Language settings would act in a list where you click a little "+" icon, select a language, and fill out those three settings for that language specifically to override the generic settings applied for non-specified languages.In the previous tutorial, you were introduced to the world of chatbot creation using the Microsoft Bot Framework. Translations but don't automatically show the translation (click to translate) I think that the way these settings should be implemented is a list of three choices:Ģ. If you want to get REALLY granular with it, perhaps even toggle by specific language. I think that for server owners if they do not want this functionality for some reason (want to keep channels a specific language / don't like the quality of the translations, etc) they should have the ability to disable this with a user, channel, role, or server setting. It would allow discord to not have to reinvent itself to users who speak other languages because they could speak seamlessly to English speakers while they invite their native Spanish/Chinese/Japanese/German etc speakers to join them. It would be a great opportunity for discord to grow in new countries and open new horizons.
![discord auto translate bot discord auto translate bot](https://user-images.githubusercontent.com/14249336/36082187-10686f90-0f75-11e8-845a-169332443f82.gif)
I think having this available would really promote two-way conversation with other languages on discord like never before, and change the way we communicate for the better. Messages sent from other languages would be auto-translated into their respective language. Users then would have an option on their account to enable auto-translated messages from foreign languages. Something like this could be implemented by having users define their preferred language when setting up their account or assume it based on region. What I have in mind is totally seamless, to allow for users to send and receive messages to users of a different language and view them in their respective languages. I have seen some feature requests for translation features before, but other requests are mostly possible with bots that send a message right after the speaker (for instance, this one). I think a great way to involve the non-English speakers from our community in our discord is to create a seamless automatic translations system for Discord. The game itself has over 8 million plays.
![discord auto translate bot discord auto translate bot](https://nvu.io/static/img/bots/discord-translator/style_1b.png)
My game is translated into 8 languages and our discord only consists of English players. I own a fairly large discord server (15k+ members) for my game and I'd like to grow it.