-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathblacklist.py
43 lines (36 loc) · 1.31 KB
/
blacklist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from pyrogram import Client, filters
from pyrogram.types import Message
from utils.misc import modules_help, prefix
from utils.scripts import format_exc
@Client.on_message(filters.command(["block"], prefix) & filters.me)
async def block_True(client: Client, message: Message):
try:
user_id = (
message.command[1]
if len(message.command) > 1
else message.reply_to_message.from_user.id
)
await client.block_user(user_id)
await message.edit(
f"<b>🤡 The <a href='tg://user?id={user_id}'>user</a> is now blacklisted!</b>"
)
except Exception as e:
await message.edit(format_exc(e))
@Client.on_message(filters.command(["unblock"], prefix) & filters.me)
async def unblock(client: Client, message: Message):
try:
user_id = (
message.command[1]
if len(message.command) > 1
else message.reply_to_message.from_user.id
)
await client.unblock_user(user_id)
await message.edit(
f"<b>☺️ <a href='tg://user?id={user_id}'>User</a> removed from the blacklist!</b>"
)
except Exception as e:
await message.edit(format_exc(e))
modules_help["blacklist"] = {
"block [id|reply]*": "block user",
"unblock [id|reply]*": "unblock user",
}