fixed wrong await #4
5
main.py
5
main.py
@ -3,7 +3,6 @@ import os
|
|||||||
import googletrans
|
import googletrans
|
||||||
import discord
|
import discord
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from discord.ext import commands
|
|
||||||
|
|
||||||
|
|
||||||
discord_bot_token = os.environ['TOKEN_DISCORD']
|
discord_bot_token = os.environ['TOKEN_DISCORD']
|
||||||
@ -53,7 +52,8 @@ async def on_message(ctx: discord.Message):
|
|||||||
|
|
||||||
for channel in translator_category.channels:
|
for channel in translator_category.channels:
|
||||||
if detected_lang != channel.name:
|
if detected_lang != channel.name:
|
||||||
translated_message = await translator.translate(str(ctx.clean_content), channel.name).text
|
translated = await translator.translate(str(ctx.clean_content), channel.name)
|
||||||
|
translated_message = translated.text
|
||||||
|
|
||||||
if str(ctx.clean_content).lower() == str(translated_message).lower():
|
if str(ctx.clean_content).lower() == str(translated_message).lower():
|
||||||
return
|
return
|
||||||
@ -73,6 +73,5 @@ async def on_message(ctx: discord.Message):
|
|||||||
###
|
###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
bot_client.run(discord_bot_token)
|
bot_client.run(discord_bot_token)
|
||||||
Loading…
x
Reference in New Issue
Block a user