diff --git a/src/common/log.ts b/src/common/log.ts index 0fdcbcd2..e836dfe7 100644 --- a/src/common/log.ts +++ b/src/common/log.ts @@ -139,8 +139,13 @@ export class LogWrapper { logMessage(msg: RawMessage, selfInfo: SelfInfo) { const isSelfSent = msg.senderUin === selfInfo.uin; - this.log(`${isSelfSent ? '发送 ->' : '接收 <-' - } ${rawMessageToText(msg)}`); + + // Intercept grey tip + if (msg.elements[0]?.elementType === ElementType.GreyTip) { + return; + } + + this.log(`${isSelfSent ? '发送 ->' : '接收 <-' } ${rawMessageToText(msg)}`); } } @@ -154,7 +159,12 @@ export function rawMessageToText(msg: RawMessage, recursiveLevel = 0): string { if (msg.chatType == ChatType.KCHATTYPEC2C) { tokens.push(`私聊 (${msg.peerUin})`); } else if (msg.chatType == ChatType.KCHATTYPEGROUP) { - tokens.push(`群聊 (群 ${msg.peerUin} 的 ${msg.senderUin})`); + if (recursiveLevel < 1) { + tokens.push(`群聊 [${msg.peerName}(${msg.peerUin})]`); + } + if (msg.senderUin !== '0') { + tokens.push(`[${msg.sendMemberName || msg.sendRemarkName || msg.sendNickName}(${msg.senderUin})]`); + } } else if (msg.chatType == ChatType.KCHATTYPEDATALINE) { tokens.push('移动设备'); } else /* temp */ { diff --git a/src/core/entities/msg.ts b/src/core/entities/msg.ts index 20cb2685..03760e6f 100644 --- a/src/core/entities/msg.ts +++ b/src/core/entities/msg.ts @@ -909,11 +909,26 @@ export interface RawMessage { */ peerUin: string; + /** + * 好友备注(如果是好友消息) + */ + remark?: string; + + /** + * 群名(如果是群消息) + */ + peerName: string; + /** * 发送者昵称(如果是好友消息) */ sendNickName: string; + /** + * 发送者好友备注(如果是群消息并且有发送者好友) + */ + sendRemarkName: string; + /** * 发送者群名片(如果是群消息) */ @@ -974,4 +989,4 @@ export interface MsgReqType { extraCnt: number } //getMsgsIncludeSelf Peer必须 byType 1 -//getMsgsWithMsgTimeAndClientSeqForC2C Peer必须 byType 3 \ No newline at end of file +//getMsgsWithMsgTimeAndClientSeqForC2C Peer必须 byType 3