加入了 聊天记录总行数内容,并且处理了聊天参与者出现退群时无昵称的bug
This commit is contained in:
@@ -70,12 +70,14 @@ def get_messages(group_id, all_contacts: dict):
|
|||||||
|
|
||||||
# 提取结果并组成带逗号的字符串
|
# 提取结果并组成带逗号的字符串
|
||||||
result = []
|
result = []
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
result.append(f"聊天记录总行数:{cursor.rowcount}")
|
||||||
for row in cursor.fetchall():
|
for row in cursor.fetchall():
|
||||||
group_id = row[0]
|
group_id = row[0]
|
||||||
timestamp = row[1]
|
timestamp = row[1]
|
||||||
sender = row[2]
|
sender = row[2]
|
||||||
content = row[3]
|
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)
|
result_str = "\n".join(result)
|
||||||
|
|||||||
Reference in New Issue
Block a user