From 29389e39f479b832e54c7cb3ddd363aebe99674f Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Sun, 16 Apr 2023 15:28:32 +0100 Subject: [PATCH] feat(BaseInteraction): Support new channel payload (#9337) * feat(BaseInteraction): support new channel payload * refactor(InteractionCreate): different approach Co-Authored-By: Synbulat Biishev --------- Co-authored-by: Synbulat Biishev Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/discord.js/src/client/actions/InteractionCreate.js | 2 +- packages/discord.js/src/structures/BaseInteraction.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/discord.js/src/client/actions/InteractionCreate.js b/packages/discord.js/src/client/actions/InteractionCreate.js index c079121c7f6f..434fb0c0689c 100644 --- a/packages/discord.js/src/client/actions/InteractionCreate.js +++ b/packages/discord.js/src/client/actions/InteractionCreate.js @@ -20,7 +20,7 @@ class InteractionCreateAction extends Action { const client = this.client; // Resolve and cache partial channels for Interaction#channel getter - const channel = this.getChannel(data); + const channel = data.channel && this.getChannel(data.channel); // Do not emit this for interactions that cache messages that are non-text-based. let InteractionClass; diff --git a/packages/discord.js/src/structures/BaseInteraction.js b/packages/discord.js/src/structures/BaseInteraction.js index 3b6db688ef02..967350fd0449 100644 --- a/packages/discord.js/src/structures/BaseInteraction.js +++ b/packages/discord.js/src/structures/BaseInteraction.js @@ -46,7 +46,7 @@ class BaseInteraction extends Base { * The id of the channel this interaction was sent in * @type {?Snowflake} */ - this.channelId = data.channel_id ?? null; + this.channelId = data.channel?.id ?? null; /** * The id of the guild this interaction was sent in