Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
idranme committed Dec 22, 2024
1 parent ee82718 commit 9582dc7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion adapters/qq/src/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ interface GetAppAccessTokenResult {

export class QQBot<C extends Context = Context> extends Bot<C, QQBot.Config> {
static MessageEncoder = QQMessageEncoder
static inject = ['server', 'http']
static inject = {
required: ['http'],
optional: ['server'],
}

public guildBot: QQGuildBot<C>

Expand Down
2 changes: 1 addition & 1 deletion adapters/qq/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class HttpServer<C extends Context = Context> extends Adapter<C, QQBot<C>

ctx.status = 200
const payload: Payload = ctx.request.body
if (payload.op === Opcode.Address_Verification) {
if (payload.op === Opcode.ADDRESS_VERIFICATION) {
const key = this.getPrivateKey(bot.config.secret)
const data = payload.d.event_ts + payload.d.plain_token
const sig = await signAsync(new TextEncoder().encode(data), key)
Expand Down
4 changes: 2 additions & 2 deletions adapters/qq/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export enum Opcode {
/** 仅用于 http 回调模式的回包,代表机器人收到了平台推送的数据 */
HTTP_CALLBACK_ACK = 12,
/** 开放平台对机器人服务端进行验证 */
Address_Verification = 13
ADDRESS_VERIFICATION = 13,
}

export type WithOpUser<T> = T & { op_user_id: string }
Expand Down Expand Up @@ -250,7 +250,7 @@ export type Payload = DispatchPayload | {
} | {
op: Opcode.INVALID_SESSION
} | {
op: Opcode.Address_Verification
op: Opcode.ADDRESS_VERIFICATION
d: {
plain_token: string
event_ts: number
Expand Down

0 comments on commit 9582dc7

Please sign in to comment.