Skip to content

Commit

Permalink
🚨 Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Dec 3, 2022
1 parent ed790ba commit 5f0451d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions cogs/misc/autotranslate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 5f0451d

Please sign in to comment.