mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-22 12:55:39 +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.errors import FloodWait
|
||||||
from pyrogram.raw.functions.contacts import GetBlocked
|
from pyrogram.raw.functions.contacts import GetBlocked
|
||||||
|
from pyrogram.raw.types.contacts import BlockedSlice
|
||||||
|
|
||||||
from pagermaid.listener import listener
|
from pagermaid.listener import listener
|
||||||
from pagermaid.enums import Client, Message
|
from pagermaid.enums import Client, Message
|
||||||
@ -27,12 +28,14 @@ async def clear_blocked_func(client: Client, message: Message):
|
|||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
await message.edit(f"🧹 Clearing blocked users...\n\nWill run after {e.value} seconds.")
|
await message.edit(f"🧹 Clearing blocked users...\n\nWill run after {e.value} seconds.")
|
||||||
await sleep(e.value + 1)
|
await sleep(e.value + 1)
|
||||||
|
with contextlib.suppress(Exception):
|
||||||
|
await message.edit("🧹 Clearing blocked users...")
|
||||||
await client.unblock_user(user.id)
|
await client.unblock_user(user.id)
|
||||||
success += 1
|
success += 1
|
||||||
except Exception:
|
except Exception:
|
||||||
failed += 1
|
failed += 1
|
||||||
offset += 100
|
offset += 100
|
||||||
if offset > blocked.count:
|
if (isinstance(blocked, BlockedSlice) and offset > blocked.count) or not isinstance(blocked, BlockedSlice):
|
||||||
break
|
break
|
||||||
return success, failed, skipped
|
return success, failed, skipped
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user