diff --git a/cogs/misc/autotranslate.py b/cogs/misc/autotranslate.py index a120fe00..7ab6d98e 100644 --- a/cogs/misc/autotranslate.py +++ b/cogs/misc/autotranslate.py @@ -100,7 +100,12 @@ async def on_message(self, message: discord.Message): state = await self.bot.db_pool.fetchval( "SELECT auto_translate FROM guilds WHERE guild_id = $1", message.guild.id ) - if not message.content or not state or message.author.id == self.bot.user.id or message.webhook_id: + if ( + not message.content + or not state + or message.author.id == self.bot.user.id + or message.webhook_id + ): return headers = { "accept": "application/json", @@ -134,9 +139,7 @@ async def on_message(self, message: discord.Message): if webhook.name == "AutoTranslate": webhook_id = webhook.id if not webhook_id: - webhook = await message.channel.create_webhook( - name="AutoTranslate" - ) + webhook = await message.channel.create_webhook(name="AutoTranslate") else: webhook = await self.bot.fetch_webhook(webhook_id) if data["language"] != guild_language: @@ -175,7 +178,9 @@ async def on_message(self, message: discord.Message): await message.channel.send( f"{message.author.mention}:\n> " + ( - await translate(message.content, guild_language) + await translate( + message.content, guild_language + ) ).replace("\n", "\n> ") + f"\n\n` {data['language']} ➜ {guild_language} | {round(data['confidence'])} `", allowed_mentions=discord.AllowedMentions.none(),