2022-04-06 14:39:27 +00:00
|
|
|
from core import command
|
|
|
|
from pyrogram import Client
|
|
|
|
from pyrogram.types import Message
|
|
|
|
from tools.helpers import get_dc_text
|
|
|
|
|
|
|
|
|
|
|
|
@Client.on_message(command('dc'))
|
|
|
|
async def dc(_: Client, msg: Message):
|
|
|
|
"""获取群聊或者目标消息用户的dc_id"""
|
|
|
|
_is_replied = bool(msg.reply_to_message)
|
|
|
|
dc_id = msg.reply_to_message.from_user.dc_id \
|
|
|
|
if _is_replied else msg.chat.dc_id
|
|
|
|
name = msg.reply_to_message.from_user.mention(style="md") \
|
2022-04-09 08:51:36 +00:00
|
|
|
if _is_replied else f"`{msg.chat.title or msg.chat.first_name}`"
|
2022-04-06 14:39:27 +00:00
|
|
|
await msg.edit_text(get_dc_text(name, dc_id))
|