packages/discord.js/src/structures/interfaces/InteractionResponses.js
/**
   * Collects a single modal submit interaction that passes the filter.
   * The Promise will reject if the time expires.
   * @param {AwaitModalSubmitOptions} options Options to pass to the internal collector
   * @returns {Promise<ModalSubmitInteraction>}
   * @example
   * // Collect a modal submit interaction
   * const filter = (interaction) => interaction.customId === 'modal';
   * interaction.awaitModalSubmit({ filter, time: 15_000 })
   *   .then(interaction => console.log(`${interaction.customId} was submitted!`))
   *   .catch(console.error);
   */
Collects a single modal submit interaction that passes the filter.
The Promise will reject if the time expires.
Collects a single modal submit interaction that passes the filter . The Promise will reject if the time expires .
awaitModalSubmit(options) {
    if (typeof options.time !== 'number') throw new Error('INVALID_TYPE', 'time', 'number');
    const _options = { ...options, max: 1, interactionType: InteractionType.ModalSubmit };
    return new Promise((resolve, reject) => {
      const collector = new InteractionCollector(this.client, _options);
      collector.once('end', (interactions, reason) => {
        const interaction = interactions.first();
        if (interaction) resolve(interaction);
        else reject(new Error('INTERACTION_COLLECTOR_ERROR', reason));
      });
    });
  }
awaitModalSubmit ( options ) { if ( typeof options . time !== 'number' ) throw new Error ( 'INVALID_TYPE' , 'time' , 'number' ) ; const _options = { ... options , max : 1 , interactionType : InteractionType . ModalSubmit } ; return new Promise ( ( resolve , reject ) => { const collector = new InteractionCollector ( this . client , _options ) ; collector . once ( 'end' , ( interactions , reason ) => { const interaction = interactions . first ( ) ; if ( interaction ) resolve ( interaction ) ; else reject ( new Error ( 'INTERACTION_COLLECTOR_ERROR' , reason ) ) ; } ) ; } ) ; }
Collects a single modal submit interaction that passes the filter.
Collects a single modal submit interaction that passes the filter .