Update misc_tools.py

This commit is contained in:
yasirarism 2022-12-16 10:23:28 +07:00 committed by GitHub
parent 27dda75ab6
commit 8d1e9a0962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,10 +132,10 @@ async def translate(client, message):
my_translator = GoogleTranslator(source='auto', target=target_lang)
try:
tresult = my_translator.translate(text=text)
await msg.edit(f"Translation using source = {my_translator.source} and target = {my_translator.target}\n\n-> {result}")
return await msg.edit(f"Translation using source = {my_translator.source} and target = {my_translator.target}\n\n-> {result}")
except MessageTooLong:
url = await rentry(tresult)
await msg.edit(f"Your translated text pasted to rentry because has long text:\n{url}")
return await msg.edit(f"Your translated text pasted to rentry because has long text:\n{url}")
except Exception as err:
await msg.edit(f"ERROR: <code>{str(err)}</code>")