fix(protocol,onebot): generate and send ark of contact cards correctly (#149)
This commit is contained in:
1 parent
02de2acea4
commit
39338c3f1d
5 files changed
+43
-29
No files matched your search
@@ -448,6 +448,13 @@ async function cacheSelfSentMessage(
|
||||
}
|
||||
}
|
||||
|
||||
function resolveContactArk(ref: OneBotInstanceContext, contactType: string, contactId: number): Promise<string> | null {
|
||||
const normalized = contactType.trim().toLowerCase();
|
||||
if (normalized === 'qq') return ref.bridge.apis.contacts.getBuddyRecommendArk(contactId, '');
|
||||
if (normalized === 'group') return ref.bridge.apis.contacts.getGroupRecommendArk(contactId);
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function sendPrivateMessage(
|
||||
ref: OneBotInstanceContext,
|
||||
userId: number,
|
||||
@@ -492,6 +499,7 @@ export async function sendPrivateMessage(
|
||||
return null;
|
||||
},
|
||||
resolveMentionUid: (targetUin) => ref.bridge.resolveUserUid(targetUin),
|
||||
resolveContactArk: (contactType, contactId) => resolveContactArk(ref, contactType, contactId),
|
||||
musicSignUrl: ref.musicSignUrl,
|
||||
});
|
||||
if (elements.length === 0) throw new Error('message is empty');
|
||||
@@ -595,6 +603,7 @@ export async function sendGroupMessage(
|
||||
return null;
|
||||
},
|
||||
resolveMentionUid: (targetUin) => ref.bridge.resolveUserUid(targetUin, groupId),
|
||||
resolveContactArk: (contactType, contactId) => resolveContactArk(ref, contactType, contactId),
|
||||
musicSignUrl: ref.musicSignUrl,
|
||||
});
|
||||
if (elements.length === 0) throw new Error('message is empty');
|
||||
|
||||
Reference in new issue
Block a user