加入了 聊天记录总行数内容,并且处理了聊天参与者出现退群时无昵称的bug

This commit is contained in:
liuwei
2025-02-20 14:23:50 +08:00
parent 78bb9be6af
commit b926cc0c99

View File

@@ -70,12 +70,14 @@ def get_messages(group_id, all_contacts: dict):
# 提取结果并组成带逗号的字符串
result = []
if cursor.rowcount > 0:
result.append(f"聊天记录总行数:{cursor.rowcount}")
for row in cursor.fetchall():
group_id = row[0]
timestamp = row[1]
sender = row[2]
content = row[3]
result.append(f"{group_id},{timestamp},{all_contacts[sender]},{content}")
result.append(f"{group_id},{timestamp},{all_contacts.get(sender, sender)},{content}")
# 将列表中的字符串连接成一个最终的结果
result_str = "\n".join(result)