Skip to content

Commit

Permalink
fix(discord): fix session.discord does not contain input
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jul 16, 2023
1 parent bffb340 commit c9a2e44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions adapters/discord/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export class DiscordBot extends Bot<DiscordBot.Config> {
ctx.plugin(WsClient, this)
}

session(payload = {}) {
return defineProperty(super.session(), 'discord', Object.assign(Object.create(this.internal), payload))
session(payload?: any, input?: any) {
return defineProperty(super.session(payload), 'discord', Object.assign(Object.create(this.internal), input))
}

private async _ensureWebhook(channelId: string) {
Expand Down
2 changes: 1 addition & 1 deletion adapters/discord/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function setupReaction(session: Partial<Session>, data: ReactionEvent) {
}

export async function adaptSession(bot: DiscordBot, input: Discord.Gateway.Payload) {
const session = bot.session()
const session = bot.session({}, input)
if (input.t === 'MESSAGE_CREATE') {
if (input.d.webhook_id) {
const webhook = await bot.ensureWebhook(input.d.channel_id)
Expand Down

0 comments on commit c9a2e44

Please sign in to comment.