forked from dwiantoni/veezmusic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshowid.py
39 lines (33 loc) · 1.18 KB
/
showid.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
"""
Get id of the replied user
Syntax: /id
"""
from pyrogram import Client
from pyrogram.types import Message
from config import BOT_USERNAME
from helpers.filters import command
from helpers.get_file_id import get_file_id
@Client.on_message(command(["id", f"id@{BOT_USERNAME}"]))
async def showid(_, message: Message):
chat_type = message.chat.type
if chat_type == "private":
user_id = message.chat.id
await message.reply_text(f"<code>{user_id}</code>")
elif chat_type in ["group", "supergroup"]:
_id = ""
_id += "<b>Chat ID</b>: " f"<code>{message.chat.id}</code>\n"
if message.reply_to_message:
_id += (
"<b>Replied User ID</b>: "
f"<code>{message.reply_to_message.from_user.id}</code>\n"
)
file_info = get_file_id(message.reply_to_message)
else:
_id += "<b>User ID</b>: " f"<code>{message.from_user.id}</code>\n"
file_info = get_file_id(message)
if file_info:
_id += (
f"<b>{file_info.message_type}</b>: "
f"<code>{file_info.file_id}</code>\n"
)
await message.reply_text(_id)