Skip to content

Commit

Permalink
fix(kook): add missing session.member
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Oct 13, 2023
1 parent f3a8497 commit 4c30cbf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions adapters/kook/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export class KookMessageEncoder extends MessageEncoder<KookBot> {
})
const { url } = await this.bot.request('POST', '/asset/create', payload, payload.getHeaders())
return url
} else {
return attrs.url
}
}

Expand Down
3 changes: 3 additions & 0 deletions adapters/kook/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ function adaptMessageCreate(data: Kook.Data, meta: Kook.MessageExtra, session: P
session.channelId = meta.code
}
session.event.channel.name = meta.channel_name
session.event.member = decodeGuildMember(data.extra.author)
session.event.user = session.event.member.user
delete session.event.member.user
adaptMessageSession(data, meta, session.event.message = {}, session.event)
}

Expand Down
1 change: 1 addition & 0 deletions adapters/kook/src/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class WsClient extends Adapter.WsClient<KookBot<KookBot.BaseConfig & WsCl
return logger.warn('cannot parse message', data)
}

logger.debug('[receive] %o', parsed)
if (parsed.s === Signal.event) {
this._sn = Math.max(this._sn, parsed.sn)
const session = adaptSession(this.bot, parsed.d)
Expand Down

0 comments on commit 4c30cbf

Please sign in to comment.