From 810ece7dcdd9f9fafc95a5557ad55ebc76e1a2ac Mon Sep 17 00:00:00 2001 From: idranme <96647698+idranme@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:50:53 +0000 Subject: [PATCH 1/7] fix(qq): fix private chat not being able to send rich media --- adapters/qq/src/message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/qq/src/message.ts b/adapters/qq/src/message.ts index bcb3ddfe..81d626d9 100644 --- a/adapters/qq/src/message.ts +++ b/adapters/qq/src/message.ts @@ -324,7 +324,7 @@ export class QQMessageEncoder extends MessageEncode let res: QQ.Message.File.Response try { if (this.session.isDirect) { - res = await this.bot.internal.sendFilePrivate(this.options.session.event.message.user.id, data) + res = await this.bot.internal.sendFilePrivate(this.options.session.userId, data) } else { res = await this.bot.internal.sendFileGuild(this.session.guildId, data) } From 3de1e25becfc636c150d1491192197913efb3aa7 Mon Sep 17 00:00:00 2001 From: idranme Date: Wed, 24 Jul 2024 20:11:37 +0800 Subject: [PATCH 2/7] fix(qq): fix the problem of not being able to use the interactions interface --- adapters/qq/src/internal/group.ts | 9 ++++++--- adapters/qq/src/internal/internal.ts | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/adapters/qq/src/internal/group.ts b/adapters/qq/src/internal/group.ts index 56cd5f62..4f514c1a 100644 --- a/adapters/qq/src/internal/group.ts +++ b/adapters/qq/src/internal/group.ts @@ -50,9 +50,6 @@ GroupInternal.define(false, { '/v2/groups/{channel.id}/files': { POST: 'sendFileGuild', }, - '/interactions/{interaction.id}': { - PUT: 'acknowledgeInteraction', - }, '/gateway': { GET: 'getGateway', }, @@ -60,3 +57,9 @@ GroupInternal.define(false, { GET: 'getGatewayBot', }, }) + +GroupInternal.define(false, { + '/interactions/{interaction.id}': { + PUT: 'acknowledgeInteraction', + }, +}, { responseType: 'text' }) \ No newline at end of file diff --git a/adapters/qq/src/internal/internal.ts b/adapters/qq/src/internal/internal.ts index ead30284..ffe17c3d 100644 --- a/adapters/qq/src/internal/internal.ts +++ b/adapters/qq/src/internal/internal.ts @@ -3,7 +3,7 @@ import { Bot, Dict, HTTP, makeArray } from '@satorijs/core' export class Internal { constructor(private bot: Bot, private http: () => HTTP) { } - static define(isGuild: boolean, routes: Dict>>) { + static define(isGuild: boolean, routes: Dict>>, config: HTTP.RequestConfig = {}) { for (const path in routes) { for (const key in routes[path]) { const method = key as HTTP.Method @@ -14,7 +14,6 @@ export class Internal { if (!args.length) throw new Error(`too few arguments for ${path}, received ${raw}`) return args.shift() }) - const config: HTTP.RequestConfig = {} if (args.length === 1) { if (method === 'GET' || method === 'DELETE') { config.params = args[0] From 72d8a177dfd0ebd28e340cc20576bc75b19d1e44 Mon Sep 17 00:00:00 2001 From: idranme Date: Wed, 24 Jul 2024 20:15:24 +0800 Subject: [PATCH 3/7] make eslint happy --- adapters/qq/src/internal/group.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/qq/src/internal/group.ts b/adapters/qq/src/internal/group.ts index 4f514c1a..a5a81f6f 100644 --- a/adapters/qq/src/internal/group.ts +++ b/adapters/qq/src/internal/group.ts @@ -62,4 +62,4 @@ GroupInternal.define(false, { '/interactions/{interaction.id}': { PUT: 'acknowledgeInteraction', }, -}, { responseType: 'text' }) \ No newline at end of file +}, { responseType: 'text' }) From 7f9000ca714585af132509e59b6428316b869686 Mon Sep 17 00:00:00 2001 From: idranme <96647698+idranme@users.noreply.github.com> Date: Wed, 24 Jul 2024 20:17:30 +0800 Subject: [PATCH 4/7] Update group.ts --- adapters/qq/src/internal/group.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/adapters/qq/src/internal/group.ts b/adapters/qq/src/internal/group.ts index a5a81f6f..f9d02d8c 100644 --- a/adapters/qq/src/internal/group.ts +++ b/adapters/qq/src/internal/group.ts @@ -58,6 +58,7 @@ GroupInternal.define(false, { }, }) +// tx.sb GroupInternal.define(false, { '/interactions/{interaction.id}': { PUT: 'acknowledgeInteraction', From 44b6ac60797a4bfaefbb434aecbaed89e580ec9a Mon Sep 17 00:00:00 2001 From: idranme <96647698+idranme@users.noreply.github.com> Date: Wed, 24 Jul 2024 20:21:09 +0800 Subject: [PATCH 5/7] Update group.ts --- adapters/qq/src/internal/group.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/qq/src/internal/group.ts b/adapters/qq/src/internal/group.ts index f9d02d8c..99b5184e 100644 --- a/adapters/qq/src/internal/group.ts +++ b/adapters/qq/src/internal/group.ts @@ -58,7 +58,7 @@ GroupInternal.define(false, { }, }) -// tx.sb +// fxxk tencent GroupInternal.define(false, { '/interactions/{interaction.id}': { PUT: 'acknowledgeInteraction', From 56d01ea9eb7821d60279bd309d1353212d537886 Mon Sep 17 00:00:00 2001 From: idranme Date: Thu, 25 Jul 2024 02:26:20 +0800 Subject: [PATCH 6/7] fix --- adapters/qq/src/internal/internal.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adapters/qq/src/internal/internal.ts b/adapters/qq/src/internal/internal.ts index ffe17c3d..03b99550 100644 --- a/adapters/qq/src/internal/internal.ts +++ b/adapters/qq/src/internal/internal.ts @@ -3,7 +3,7 @@ import { Bot, Dict, HTTP, makeArray } from '@satorijs/core' export class Internal { constructor(private bot: Bot, private http: () => HTTP) { } - static define(isGuild: boolean, routes: Dict>>, config: HTTP.RequestConfig = {}) { + static define(isGuild: boolean, routes: Dict>>, preset: HTTP.RequestConfig = {}) { for (const path in routes) { for (const key in routes[path]) { const method = key as HTTP.Method @@ -14,6 +14,7 @@ export class Internal { if (!args.length) throw new Error(`too few arguments for ${path}, received ${raw}`) return args.shift() }) + const config: HTTP.RequestConfig = { ...preset } if (args.length === 1) { if (method === 'GET' || method === 'DELETE') { config.params = args[0] From e76ac15ded9be302b2cbc8416fa3821682f2eb30 Mon Sep 17 00:00:00 2001 From: idranme Date: Thu, 25 Jul 2024 02:46:26 +0800 Subject: [PATCH 7/7] opt --- adapters/qq/src/internal/internal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/qq/src/internal/internal.ts b/adapters/qq/src/internal/internal.ts index 03b99550..bcb4d62b 100644 --- a/adapters/qq/src/internal/internal.ts +++ b/adapters/qq/src/internal/internal.ts @@ -3,7 +3,7 @@ import { Bot, Dict, HTTP, makeArray } from '@satorijs/core' export class Internal { constructor(private bot: Bot, private http: () => HTTP) { } - static define(isGuild: boolean, routes: Dict>>, preset: HTTP.RequestConfig = {}) { + static define(isGuild: boolean, routes: Dict>>, preset?: HTTP.RequestConfig) { for (const path in routes) { for (const key in routes[path]) { const method = key as HTTP.Method