fix: interaction response

This commit is contained in:
Elysia
2023-06-14 13:53:09 +07:00
parent e8f3b590c1
commit bd66c99ef2
4 changed files with 5 additions and 5 deletions

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();