fix: at element

This commit is contained in:
idranme 2024-10-11 00:50:06 +08:00
parent 6bb4a8fe69
commit 2b0aa6249b
2 changed files with 10 additions and 3 deletions

View File

@ -73,7 +73,7 @@ export class NTQQGroupApi extends Service {
cbCmd: 'nodeIKernelGroupListener/onMemberInfoChange',
afterFirstCmd: false,
cmdCB: payload => payload.members.has(uid),
timeout: 3000
timeout: 2000
}
)
return data.members.get(uid)!

View File

@ -67,8 +67,15 @@ export async function createSendElements(
}
else if (peer.chatType === ChatType.Group) {
const uid = await ctx.ntUserApi.getUidByUin(atQQ) ?? ''
const atNmae = sendMsg.data?.name
const display = atNmae ? `@${atNmae}` : ''
let display = ''
if (sendMsg.data.name) {
display = `@${sendMsg.data.name}`
} else {
try {
const member = await ctx.ntGroupApi.getGroupMember(peer.peerUid, uid)
display = `@${member.cardName || member.nick}`
} catch { }
}
sendElements.push(SendElement.at(atQQ, uid, AtType.One, display))
}
}