From 265e0be92c69fc80d5f037718f028d9fbdf4e689 Mon Sep 17 00:00:00 2001 From: thedragonsinn <98635854+thedragonsinn@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:24:18 +0530 Subject: [PATCH] fixes. --- .gitignore | 1 + app/core/client/client.py | 2 +- app/plugins/admin_tools.py | 7 +++++-- app/plugins/tg_utils.py | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index dff707c..47b015d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ config*.env venv/ __pycache__ .idea/ +conf_backup/ diff --git a/app/core/client/client.py b/app/core/client/client.py index e0e0d49..c9632d8 100644 --- a/app/core/client/client.py +++ b/app/core/client/client.py @@ -87,7 +87,7 @@ class BOT(Client): parse_mode=ParseMode.HTML, ) -> Message | Msg: if message: - return await message.copy(chat_id=Config.LOG_CHAT) + return (await message.copy(chat_id=Config.LOG_CHAT)) if traceback: text = f""" #Traceback diff --git a/app/plugins/admin_tools.py b/app/plugins/admin_tools.py index 0232039..530e72b 100644 --- a/app/plugins/admin_tools.py +++ b/app/plugins/admin_tools.py @@ -1,4 +1,4 @@ -from typing import Awaitable +from typing import Awaitable from pyrogram.types import ChatPermissions, ChatPrivileges, User @@ -50,11 +50,14 @@ async def promote_or_demote(bot: bot, message: Message) -> None: chat_id=message.chat.id, user_id=user.id, privileges=privileges ) if not demote: + # Let server promote admin before setting title + # Bot is too fast moment 😂😂😂 + await asyncio.sleep(3) await bot.set_administrator_title( chat_id=message.chat.id, user_id=user.id, title=title or "Admin" ) if title: - response += f"\nTitle: {title}." + response += f"\nTitle: {title}" await message.reply(text=response) except Exception as e: await message.reply(text=e, del_in=10, block=True) diff --git a/app/plugins/tg_utils.py b/app/plugins/tg_utils.py index 68d44b0..553a440 100644 --- a/app/plugins/tg_utils.py +++ b/app/plugins/tg_utils.py @@ -55,9 +55,10 @@ async def join_chat(bot: bot, message: Message) -> None: except (KeyError, BadRequest): try: await bot.join_chat(os.path.basename(chat).strip()) - await message.reply("Joined") except Exception as e: await message.reply(str(e)) + return + await message.reply("Joined") @bot.add_cmd(cmd="leave")