Skip to content

Commit b61e4fb

Browse files
cobaltt7almeidxkodiakhq[bot]
authored
fix: awaitMessageComponent with MessageComponentInteractions (#8598)
* fix: `awaitMessageComponent` with `MessageComponentInteraction`s Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> * Update packages/discord.js/src/structures/InteractionCollector.js Co-authored-by: Almeida <almeidx@pm.me> * types: revert unrelated changes Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> * Remove unneeded truey check Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> * chore: remove extra block Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> * fix: `awaitMessageComponent` with `MessageComponentInteraction`s Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> * fix: `awaitMessageComponent` with `MessageComponentInteraction`s Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> --------- Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com> Co-authored-by: Almeida <almeidx@pm.me> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent d64330a commit b61e4fb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/discord.js/src/structures/InteractionCollector.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class InteractionCollector extends Collector {
4040
* The message from which to collect interactions, if provided
4141
* @type {?Snowflake}
4242
*/
43-
this.messageId = options.message?.id ?? null;
43+
this.messageId = options.message?.id ?? options.interactionResponse?.interaction.message?.id ?? null;
4444

4545
/**
4646
* The message interaction id from which to collect interactions, if provided
@@ -178,7 +178,13 @@ class InteractionCollector extends Collector {
178178
if (this.type && interaction.type !== this.type) return null;
179179
if (this.componentType && interaction.componentType !== this.componentType) return null;
180180
if (this.messageId && interaction.message?.id !== this.messageId) return null;
181-
if (this.messageInteractionId && interaction.message?.interaction?.id !== this.messageInteractionId) return null;
181+
if (
182+
this.messageInteractionId &&
183+
interaction.message?.interaction?.id &&
184+
interaction.message.interaction.id !== this.messageInteractionId
185+
) {
186+
return null;
187+
}
182188
if (this.channelId && interaction.channelId !== this.channelId) return null;
183189
if (this.guildId && interaction.guildId !== this.guildId) return null;
184190

0 commit comments

Comments
 (0)