Skip to content

Commit

Permalink
fix(modal): check and set replied flags
Browse files Browse the repository at this point in the history
  • Loading branch information
monbrey committed Feb 22, 2022
1 parent 8a2c025 commit 4e586e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/structures/interfaces/InteractionResponses.js
Expand Up @@ -232,13 +232,16 @@ class InteractionResponses {
* @returns {Promise<void>}
*/
async showModal(modal) {
if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');

const _modal = modal instanceof Modal ? modal : new Modal(modal);
await this.client.api.interactions(this.id, this.token).callback.post({
data: {
type: InteractionResponseTypes.MODAL,
data: _modal.toJSON(),
},
});
this.replied = true;
}

/**
Expand Down

0 comments on commit 4e586e2

Please sign in to comment.