treewide: some fixes

This commit is contained in:
levina 2022-02-24 07:57:22 +07:00 committed by GitHub
parent 1bccc0be31
commit 218666561b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,8 +174,21 @@ async def ungban_global(c: Client, message: Message):
if not is_gbanned: if not is_gbanned:
await message.reply_text("This user is not gbanned !") await message.reply_text("This user is not gbanned !")
else: else:
await c.unban_chat_member(chat_id, user.id)
await remove_gban_user(user.id) await remove_gban_user(user.id)
served_chats = []
chats = await get_served_chats()
for chat in chats:
served_chats.append(int(chat["chat_id"]))
number_of_chats = 0
for num in served_chats:
try:
await c.unban_chat_member(num, user.id)
number_of_chats += 1
await asyncio.sleep(1)
except FloodWait as e:
await asyncio.sleep(int(e.x))
except BaseException:
pass
await message.reply_text("✅ This user has ungbanned") await message.reply_text("✅ This user has ungbanned")
return return
from_user_id = message.from_user.id from_user_id = message.from_user.id
@ -195,6 +208,19 @@ async def ungban_global(c: Client, message: Message):
if not is_gbanned: if not is_gbanned:
await message.reply_text("This user is not gbanned !") await message.reply_text("This user is not gbanned !")
else: else:
await c.unban_chat_member(chat_id, user_id)
await remove_gban_user(user_id) await remove_gban_user(user_id)
served_chats = []
chats = await get_served_chats()
for chat in chats:
served_chats.append(int(chat["chat_id"]))
number_of_chats = 0
for num in served_chats:
try:
await c.unban_chat_member(num, user_id)
number_of_chats += 1
await asyncio.sleep(1)
except FloodWait as e:
await asyncio.sleep(int(e.x))
except BaseException:
pass
await message.reply_text("✅ This user has ungbanned") await message.reply_text("✅ This user has ungbanned")