🔧 修改 userid 错误逻辑

This commit is contained in:
Xtao_dada 2020-05-17 11:21:05 +08:00 committed by GitHub
parent aa2533dae6
commit 6a94dc80ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,14 +17,14 @@ async def userid(context):
""" Query the UserID of the sender of the message you replied to. """ """ Query the UserID of the sender of the message you replied to. """
message = await context.get_reply_message() message = await context.get_reply_message()
if message: if message:
user_id = message.sender.id user_id = message.sender.id
if message.sender.username: if message.sender.username:
target = "@" + message.sender.username target = "@" + message.sender.username
else: else:
try: try:
target = "**" + message.sender.first_name + "**" target = "**" + message.sender.first_name + "**"
except TypeError: except TypeError:
target = "**" + "死号" + "**" target = "**" + "死号" + "**"
if not message.forward: if not message.forward:
await context.edit( await context.edit(
f"**以下是被回复消息的信息** \n\n**道纹:** {target} \n" f"**以下是被回复消息的信息** \n\n**道纹:** {target} \n"