[check] some changes

This commit is contained in:
levina 2022-02-24 12:02:44 +07:00 committed by GitHub
parent 328558d754
commit 346012c9ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,7 @@ from inspect import getfullargspec
from config import BOT_USERNAME as bname from config import BOT_USERNAME as bname
from driver.core import bot from driver.core import bot
from driver.queues import QUEUE
from driver.filters import command from driver.filters import command
from driver.database.dbchat import remove_served_chat from driver.database.dbchat import remove_served_chat
from driver.decorators import bot_creator, sudo_users_only, errors from driver.decorators import bot_creator, sudo_users_only, errors
@ -198,11 +199,14 @@ async def bot_leave_group(_, message):
) )
return return
chat = message.text.split(None, 2)[1] chat = message.text.split(None, 2)[1]
if chat in QUEUE:
await remove_active_chat(chat)
return
try: try:
await bot.leave_chat(chat) await bot.leave_chat(chat)
await user.leave_chat(chat)
await remove_served_chat(chat) await remove_served_chat(chat)
except Exception as e: except Exception as e:
await message.reply_text(f"❌ procces failed\n\nreason: `{e}`") await message.reply_text(f"❌ procces failed\n\nreason: `{e}`")
print(e)
return return
await message.reply_text(f"✅ Bot successfully left from the Group:\n\n💭 » `{chat}`") await message.reply_text(f"✅ Bot successfully left from the Group:\n\n💭 » `{chat}`")