mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
update: log group name & sender nickname onto console
This commit is contained in:
parent
9687832d4d
commit
d91b55faed
@ -139,8 +139,13 @@ export class LogWrapper {
|
|||||||
|
|
||||||
logMessage(msg: RawMessage, selfInfo: SelfInfo) {
|
logMessage(msg: RawMessage, selfInfo: SelfInfo) {
|
||||||
const isSelfSent = msg.senderUin === selfInfo.uin;
|
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) {
|
if (msg.chatType == ChatType.KCHATTYPEC2C) {
|
||||||
tokens.push(`私聊 (${msg.peerUin})`);
|
tokens.push(`私聊 (${msg.peerUin})`);
|
||||||
} else if (msg.chatType == ChatType.KCHATTYPEGROUP) {
|
} 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) {
|
} else if (msg.chatType == ChatType.KCHATTYPEDATALINE) {
|
||||||
tokens.push('移动设备');
|
tokens.push('移动设备');
|
||||||
} else /* temp */ {
|
} else /* temp */ {
|
||||||
|
@ -909,11 +909,26 @@ export interface RawMessage {
|
|||||||
*/
|
*/
|
||||||
peerUin: string;
|
peerUin: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 好友备注(如果是好友消息)
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 群名(如果是群消息)
|
||||||
|
*/
|
||||||
|
peerName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送者昵称(如果是好友消息)
|
* 发送者昵称(如果是好友消息)
|
||||||
*/
|
*/
|
||||||
sendNickName: string;
|
sendNickName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送者好友备注(如果是群消息并且有发送者好友)
|
||||||
|
*/
|
||||||
|
sendRemarkName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送者群名片(如果是群消息)
|
* 发送者群名片(如果是群消息)
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user