mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-22 07:08:19 +00:00
clear_blocked 修复错误
This commit is contained in:
parent
c6b6ec5c29
commit
a5fbac4412
@ -4,6 +4,7 @@ from asyncio import sleep
|
||||
|
||||
from pyrogram.errors import FloodWait
|
||||
from pyrogram.raw.functions.contacts import GetBlocked
|
||||
from pyrogram.raw.types.contacts import BlockedSlice
|
||||
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.enums import Client, Message
|
||||
@ -27,12 +28,14 @@ async def clear_blocked_func(client: Client, message: Message):
|
||||
with contextlib.suppress(Exception):
|
||||
await message.edit(f"🧹 Clearing blocked users...\n\nWill run after {e.value} seconds.")
|
||||
await sleep(e.value + 1)
|
||||
with contextlib.suppress(Exception):
|
||||
await message.edit("🧹 Clearing blocked users...")
|
||||
await client.unblock_user(user.id)
|
||||
success += 1
|
||||
except Exception:
|
||||
failed += 1
|
||||
offset += 100
|
||||
if offset > blocked.count:
|
||||
if (isinstance(blocked, BlockedSlice) and offset > blocked.count) or not isinstance(blocked, BlockedSlice):
|
||||
break
|
||||
return success, failed, skipped
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user