Skip to content

Commit

Permalink
fix(qq): parse interaction data
Browse files Browse the repository at this point in the history
  • Loading branch information
XxLittleCxX committed Nov 25, 2023
1 parent 45b1ffa commit f393a86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions adapters/qq/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1233,13 +1233,14 @@ export interface Interaction {
timestamp: string
guild_id: string
channel_id: string
group_open_id: string
group_openid: string
group_member_openid: string
chat_type: ChatType
data: {
resolved: {
button_data: string
button_id: string
user_id: string
user_id?: string
}
}
version: 1
Expand Down
6 changes: 3 additions & 3 deletions adapters/qq/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ export async function adaptSession<C extends Context = Context>(bot: QQBot<C>, i
session.operatorId = input.d.op_member_openid
} else if (input.t === 'INTERACTION_CREATE') {
session.type = 'interaction/button'
session.userId = input.d.data.resolved.user_id
session.userId = input.d.group_member_openid ?? input.d.data.resolved.user_id
if (input.d.chat_type === QQ.ChatType.GROUP) {
session.guildId = input.d.group_open_id
session.channelId = input.d.group_open_id
session.guildId = input.d.group_openid
session.channelId = input.d.group_openid
session.isDirect = false
} else if (input.d.chat_type === QQ.ChatType.CHANNEL) {
session.channelId = input.d.channel_id
Expand Down

0 comments on commit f393a86

Please sign in to comment.