From 66b967167d2ef09446399ebc12ad8f58cef00eff Mon Sep 17 00:00:00 2001 From: LittleC <26459759+XxLittleCxX@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:16:55 +0800 Subject: [PATCH 1/2] fix(qq): add lost `session.qqguild` api --- adapters/qq/src/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adapters/qq/src/utils.ts b/adapters/qq/src/utils.ts index 2d209c3c..e40e6b2b 100644 --- a/adapters/qq/src/utils.ts +++ b/adapters/qq/src/utils.ts @@ -115,9 +115,11 @@ export async function adaptSession(bot: QQBot, i if (!['GROUP_AT_MESSAGE_CREATE', 'C2C_MESSAGE_CREATE', 'FRIEND_ADD', 'FRIEND_DEL', 'GROUP_ADD_ROBOT', 'GROUP_DEL_ROBOT', 'INTERACTION_CREATE'].includes(input.t)) { session = bot.guildBot.session() + session.setInternal(bot.guildBot.platform, input) + } else { + session.setInternal(bot.platform, input) } - session.setInternal(bot.platform, input) if (input.t === 'MESSAGE_CREATE' || input.t === 'AT_MESSAGE_CREATE' || input.t === 'DIRECT_MESSAGE_CREATE') { if (bot.config.type === 'private' && input.t === 'AT_MESSAGE_CREATE' && bot.config.intents & QQ.Intents.GUILD_MESSAGES) return session.type = 'message' From 63ca479960035929c070592a33c50daa82e264da Mon Sep 17 00:00:00 2001 From: LittleC <26459759+XxLittleCxX@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:17:23 +0800 Subject: [PATCH 2/2] fix(qq): wrong interaction api --- adapters/qq/src/internal/group.ts | 8 +++++--- adapters/qq/src/utils.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/adapters/qq/src/internal/group.ts b/adapters/qq/src/internal/group.ts index 82ba1213..5bba346d 100644 --- a/adapters/qq/src/internal/group.ts +++ b/adapters/qq/src/internal/group.ts @@ -14,7 +14,9 @@ declare module './internal' { sendPrivateMessage(openid: string, data: QQ.Message.Request): Promise sendFilePrivate(openid: string, data: QQ.Message.File.Request): Promise sendFileGuild(group_openid: string, data: QQ.Message.File.Request): Promise - acknowledgeInteraction(interaction_id: string, code: number): Promise + acknowledgeInteraction(interaction_id: string, data: { + code: number + }): Promise } } @@ -31,7 +33,7 @@ GroupInternal.define(false, { '/v2/groups/{channel.id}/files': { POST: 'sendFileGuild', }, - '/interactions/{interaction.id}/{interaction.token}/callback': { - POST: 'acknowledgeInteraction', + '/interactions/{interaction.id}': { + PUT: 'acknowledgeInteraction', }, }) diff --git a/adapters/qq/src/utils.ts b/adapters/qq/src/utils.ts index e40e6b2b..b9fbbc87 100644 --- a/adapters/qq/src/utils.ts +++ b/adapters/qq/src/utils.ts @@ -214,7 +214,7 @@ export async function adaptSession(bot: QQBot, i // {message: 'get header appid failed', code: 630006} // {"message":"check app privilege not pass","code":11253 - bot.internal.acknowledgeInteraction(input.d.id, 0).catch(() => {}) + bot.internal.acknowledgeInteraction(input.d.id, { code: 0 }).catch(() => { }) } else if (input.t === 'GUILD_MEMBER_ADD' || input.t === 'GUILD_MEMBER_DELETE' || input.t === 'GUILD_MEMBER_UPDATE') { session.type = { GUILD_MEMBER_ADD: 'guild-member-added',