From bd66c99ef2c3dc55adc0fd83637ec9b96f14c00c Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:53:09 +0700 Subject: [PATCH] fix: interaction response --- src/structures/ApplicationCommand.js | 4 ++-- src/structures/MessageButton.js | 2 +- src/structures/MessageSelectMenu.js | 2 +- src/structures/Modal.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/structures/ApplicationCommand.js b/src/structures/ApplicationCommand.js index 15a6515..a891ebf 100644 --- a/src/structures/ApplicationCommand.js +++ b/src/structures/ApplicationCommand.js @@ -891,7 +891,7 @@ class ApplicationCommand extends Base { return new Promise((resolve, reject) => { const handler = data => { timeout.refresh(); - if (data.metadata.nonce !== nonce) return; + if (data.metadata?.nonce !== nonce) return; clearTimeout(timeout); this.client.removeListener('interactionResponse', handler); this.client.decrementMaxListeners(); @@ -987,7 +987,7 @@ class ApplicationCommand extends Base { return new Promise((resolve, reject) => { const handler = data => { timeout.refresh(); - if (data.metadata.nonce !== nonce) return; + if (data.metadata?.nonce !== nonce) return; clearTimeout(timeout); this.client.removeListener('interactionResponse', handler); this.client.decrementMaxListeners(); diff --git a/src/structures/MessageButton.js b/src/structures/MessageButton.js index 835d115..5b9455a 100644 --- a/src/structures/MessageButton.js +++ b/src/structures/MessageButton.js @@ -199,7 +199,7 @@ class MessageButton extends BaseMessageComponent { return new Promise((resolve, reject) => { const handler = data => { timeout.refresh(); - if (data.metadata.nonce !== nonce) return; + if (data.metadata?.nonce !== nonce) return; clearTimeout(timeout); message.client.removeListener('interactionResponse', handler); message.client.decrementMaxListeners(); diff --git a/src/structures/MessageSelectMenu.js b/src/structures/MessageSelectMenu.js index a017cc4..e597688 100644 --- a/src/structures/MessageSelectMenu.js +++ b/src/structures/MessageSelectMenu.js @@ -359,7 +359,7 @@ class MessageSelectMenu extends BaseMessageComponent { return new Promise((resolve, reject) => { const handler = data => { timeout.refresh(); - if (data.metadata.nonce !== nonce) return; + if (data.metadata?.nonce !== nonce) return; clearTimeout(timeout); message.client.removeListener('interactionResponse', handler); message.client.decrementMaxListeners(); diff --git a/src/structures/Modal.js b/src/structures/Modal.js index e929737..dd7812e 100644 --- a/src/structures/Modal.js +++ b/src/structures/Modal.js @@ -247,7 +247,7 @@ class Modal { return new Promise((resolve, reject) => { const handler = data => { timeout.refresh(); - if (data.metadata.nonce !== nonce) return; + if (data.metadata?.nonce !== nonce) return; clearTimeout(timeout); this.client.removeListener('interactionResponse', handler); this.client.decrementMaxListeners();