From b3fbe9e34ac2e000572ecd7e8c5f47f46ef98c41 Mon Sep 17 00:00:00 2001 From: huankong233 Date: Wed, 23 Oct 2024 09:05:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20contact=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=BE=A4=E8=81=8A=E5=92=8C=E7=A7=81=E8=81=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/services/NodeIKernelGroupService.ts | 2 +- src/onebot/api/msg.ts | 20 ++++++++++++++------ src/onebot/types/message.ts | 1 + 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/core/services/NodeIKernelGroupService.ts b/src/core/services/NodeIKernelGroupService.ts index 252db0e8..d46255af 100644 --- a/src/core/services/NodeIKernelGroupService.ts +++ b/src/core/services/NodeIKernelGroupService.ts @@ -239,7 +239,7 @@ export interface NodeIKernelGroupService { setMemberShutUp(groupCode: string, memberTimes: { uid: string, timeStamp: number }[]): Promise; - getGroupRecommendContactArkJson(groupCode: string): unknown; + getGroupRecommendContactArkJson(groupCode: string): Promise; getJoinGroupLink(param: { groupCode: string, diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index afe3e9cb..b4b008a3 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -624,12 +624,20 @@ export class OneBotMsgApi { [OB11MessageDataType.miniapp]: async () => undefined, - [OB11MessageDataType.contact]: async ({ data }, context) => { - const arkJson = await this.core.apis.UserApi.getBuddyRecommendContactArkJson(data.id.toString(), ''); - return this.ob11ToRawConverters.json({ - data: { data: arkJson.arkMsg }, - type: OB11MessageDataType.json - }, context); + [OB11MessageDataType.contact]: async ({ data: { type = "qq", id } }, context) => { + if(type === "qq"){ + const arkJson = await this.core.apis.UserApi.getBuddyRecommendContactArkJson(id.toString(), ''); + return this.ob11ToRawConverters.json({ + data: { data: arkJson.arkMsg }, + type: OB11MessageDataType.json + }, context); + }else if(type === "group"){ + const arkJson = await this.core.apis.GroupApi.getGroupRecommendContactArkJson(id.toString()); + return this.ob11ToRawConverters.json({ + data: { data: arkJson.arkJson }, + type: OB11MessageDataType.json + }, context); + } } }; diff --git a/src/onebot/types/message.ts b/src/onebot/types/message.ts index 93ab4180..d4890e34 100644 --- a/src/onebot/types/message.ts +++ b/src/onebot/types/message.ts @@ -85,6 +85,7 @@ export interface OB11MessageText { export interface OB11MessageContext { type: OB11MessageDataType.contact, data: { + type:"qq"|"group", id: string, } }