🐛 修复 -id 无法在私聊中使用的问题 (#48)

* Update README.md

* 🐛 修复 -id 无法在私聊中使用的问题
This commit is contained in:
Xtao_dada 2021-02-07 09:24:10 +08:00 committed by GitHub
parent 6a18cef002
commit 431906a924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View File

@ -87,6 +87,10 @@ Pagermaid 是一个用在 Telegram 的实用工具。
尤其是需要保护好 `pagermaid.session` ,任何拥有此文件的人都可以进行包括修改二次验证密码、更改手机号等操作。
# 与原作者联络
您可以在搭建完毕后在 Telegram 客户端上使用 -contact <message> 并点击链接进入通过 Pagermaid 自动打开的 PM ,如果您安装上出现了问题,请通过 [stykers@stykers.moe](mailto:stykers@stykers.moe) 给我发电子邮件,或在 Telegram [@KatOnKeyboard](https://t.me/KatOnKeyboard) 上给我发消息。
# 特别感谢
[Amine Oversoul](https://bitbucket.org/oversoul/pagermaid-ui)

View File

@ -18,22 +18,23 @@ async def userid(context):
message = await context.get_reply_message()
text = "Message ID: `" + str(context.message.id) + "`\n\n"
text += "**Chat**\nid:`" + str(context.chat_id) + "`\n"
msg_from = context.chat if context.chat else (await context.get_chat())
if context.is_private:
try:
text += "first_name: `" + context.chat.first_name + "`\n"
text += "first_name: `" + msg_from.first_name + "`\n"
except TypeError:
text += "**死号**\n"
if context.chat.last_name:
text += "last_name: `" + context.chat.last_name + "`\n"
if context.chat.username:
text += "username: @" + context.chat.username + "\n"
if context.chat.lang_code:
text += "lang_code: `" + context.chat.lang_code + "`\n"
if msg_from.last_name:
text += "last_name: `" + msg_from.last_name + "`\n"
if msg_from.username:
text += "username: @" + msg_from.username + "\n"
if msg_from.lang_code:
text += "lang_code: `" + msg_from.lang_code + "`\n"
if context.is_group or context.is_channel:
text += "title: `" + context.chat.title + "`\n"
if context.chat.username:
text += "username: @" + context.chat.username + "\n"
text += "date: `" + str(context.chat.date) + "`\n"
text += "title: `" + msg_from.title + "`\n"
if msg_from.username:
text += "username: @" + msg_from.username + "\n"
text += "date: `" + str(msg_from.date) + "`\n"
if message:
text += "\n以下是被回复消息的信息\nMessage ID: `" + str(message.id) + "`\n\n**User**\nid: `" + str(message.sender.id) + "`"
if message.sender.bot: