Fix & re-enable Translate

pull/72/head
Stijn De Clercq 2021-06-19 21:17:20 +02:00
parent 26b356b08b
commit 543eb38417
1 changed files with 6 additions and 4 deletions

View File

@ -15,8 +15,8 @@ class Translate(commands.Cog):
def cog_check(self, ctx): def cog_check(self, ctx):
return not self.client.locked return not self.client.locked
# @commands.command(name="Translate", aliases=["Tl", "Trans"], usage="[Tekst] [Van]* [Naar]*") @commands.command(name="Translate", aliases=["Tl", "Trans"], usage="[Tekst] [Van]* [Naar]*")
# @help.Category(Category.Words) @help.Category(Category.Words)
async def translate(self, ctx, query=None, to="nl", fr="auto"): async def translate(self, ctx, query=None, to="nl", fr="auto"):
if query is None: if query is None:
return await ctx.send("Controleer je argumenten.") return await ctx.send("Controleer je argumenten.")
@ -39,9 +39,11 @@ class Translate(commands.Cog):
embed.set_author(name="Didier Translate") embed.set_author(name="Didier Translate")
if fr == "auto": if fr == "auto":
language = translation.extra_data["original-language"] language = translation.src
embed.add_field(name="Gedetecteerde taal", value=tc(LANGUAGES[language])) embed.add_field(name="Gedetecteerde taal", value=tc(LANGUAGES[language]))
embed.add_field(name="Zekerheid", value="{}%".format(translation.extra_data["confidence"] * 100))
if translation.extra_data["confidence"] is not None:
embed.add_field(name="Zekerheid", value="{}%".format(translation.extra_data["confidence"] * 100))
embed.add_field(name="Origineel ({})".format(translation.src.upper()), value=query, inline=False) embed.add_field(name="Origineel ({})".format(translation.src.upper()), value=query, inline=False)
embed.add_field(name="Vertaling ({})".format(to.upper()), value=translation.text) embed.add_field(name="Vertaling ({})".format(to.upper()), value=translation.text)