fixbug:修复如果存在群里面有人退出,参与排行的人会出故障,导致发送失败
This commit is contained in:
@@ -69,7 +69,7 @@ def generate_and_send_ranking(groupId, allContacts: dict):
|
||||
# 格式化输出字符串
|
||||
ranking_str = yesterday + "发言数量前20的用户排名:\n"
|
||||
for rank, (username, speech_count) in enumerate(results, start=1):
|
||||
ranking_str += f"{rank}. {allContacts[username]}: {speech_count} 次发言\n"
|
||||
ranking_str += f"{rank}. {allContacts.get(username, username)}: {speech_count} 次发言\n"
|
||||
# 关闭数据库连接
|
||||
connection.close()
|
||||
print(ranking_str)
|
||||
|
||||
Reference in New Issue
Block a user