Skip to content

Commit

Permalink
fix(qq): interaction API didn't return valid content (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
idranme authored Jul 29, 2024
1 parent ef7160b commit 09a931c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions adapters/qq/src/internal/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ GroupInternal.define(false, {
'/v2/groups/{channel.id}/files': {
POST: 'sendFileGuild',
},
'/interactions/{interaction.id}': {
PUT: 'acknowledgeInteraction',
},
'/gateway': {
GET: 'getGateway',
},
'/gateway/bot': {
GET: 'getGatewayBot',
},
})

// fxxk tencent
GroupInternal.define(false, {
'/interactions/{interaction.id}': {
PUT: 'acknowledgeInteraction',
},
}, { responseType: 'text' })
4 changes: 2 additions & 2 deletions adapters/qq/src/internal/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Partial<Record<HTTP.Method, string | string[]>>>) {
static define(isGuild: boolean, routes: Dict<Partial<Record<HTTP.Method, string | string[]>>>, preset?: HTTP.RequestConfig) {
for (const path in routes) {
for (const key in routes[path]) {
const method = key as HTTP.Method
Expand All @@ -14,7 +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 = {}
const config: HTTP.RequestConfig = { ...preset }
if (args.length === 1) {
if (method === 'GET' || method === 'DELETE') {
config.params = args[0]
Expand Down

0 comments on commit 09a931c

Please sign in to comment.