修复获取用户名字Bug

This commit is contained in:
机器人总动员 2021-05-07 07:55:32 +08:00
parent 6321ed764e
commit 7a7a8cca69

View File

@ -46,12 +46,12 @@ def chat_content_exec(update, context):
firstname = "" firstname = ""
lastname = "" lastname = ""
try: try:
firstname = user["firstname"] firstname = str(user["first_name"])
except Exception as e: except Exception as e:
print(e) print(e)
print("用户没有设置 firstname") print("用户没有设置 firstname")
try: try:
lastname = user["last_name"] lastname = str(user["last_name"])
except Exception as e: except Exception as e:
print(e) print(e)
print("用户没有设置 last_name") print("用户没有设置 last_name")
@ -80,6 +80,7 @@ def chat_content_exec(update, context):
r.hincrby("{}_user_message_amount".format(chat_id), name) r.hincrby("{}_user_message_amount".format(chat_id), name)
print("---------------------------") print("---------------------------")
except Exception as e: except Exception as e:
print(e)
print("用户数据提取、入库错误") print("用户数据提取、入库错误")