mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
fix: remove remnants of awaitMessageComponentInteractions (#5783)
This commit is contained in:
@@ -92,7 +92,7 @@ class DMChannel extends Channel {
|
|||||||
createMessageCollector() {}
|
createMessageCollector() {}
|
||||||
awaitMessages() {}
|
awaitMessages() {}
|
||||||
createMessageComponentInteractionCollector() {}
|
createMessageComponentInteractionCollector() {}
|
||||||
awaitMessageComponentInteractions() {}
|
awaitMessageComponentInteraction() {}
|
||||||
// Doesn't work on DM channels; bulkDelete() {}
|
// Doesn't work on DM channels; bulkDelete() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -440,30 +440,25 @@ class Message extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An object containing the same properties as CollectorOptions, but a few more:
|
* Collects a single component interaction that passes the filter.
|
||||||
* @typedef {MessageComponentInteractionCollectorOptions} AwaitMessageComponentInteractionsOptions
|
* The Promise will reject if the time expires.
|
||||||
* @property {string[]} [errors] Stop/end reasons that cause the promise to reject
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Similar to createMessageComponentInteractionCollector but in promise form.
|
|
||||||
* Resolves with a collection of interactions that pass the specified filter.
|
|
||||||
* @param {CollectorFilter} filter The filter function to use
|
* @param {CollectorFilter} filter The filter function to use
|
||||||
* @param {AwaitMessageComponentInteractionsOptions} [options={}] Optional options to pass to the internal collector
|
* @param {number} [time] Time to wait for an interaction before rejecting
|
||||||
* @returns {Promise<Collection<string, MessageComponentInteraction>>}
|
* @returns {Promise<MessageComponentInteraction>}
|
||||||
* @example
|
* @example
|
||||||
* // Create a message component interaction collector
|
* // Collect a message component interaction
|
||||||
* const filter = (interaction) => interaction.customID === 'button' && interaction.user.id === 'someID';
|
* const filter = (interaction) => interaction.customID === 'button' && interaction.user.id === 'someID';
|
||||||
* message.awaitMessageComponentInteractions(filter, { time: 15000 })
|
* message.awaitMessageComponentInteraction(filter, 15000)
|
||||||
* .then(collected => console.log(`Collected ${collected.size} interactions`))
|
* .then(interaction => console.log(`${interaction.customID} was clicked!`))
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
awaitMessageComponentInteractions(filter, options = {}) {
|
awaitMessageComponentInteraction(filter, time) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const collector = this.createMessageComponentInteractionCollector(filter, options);
|
const collector = this.createMessageComponentInteractionCollector(filter, { max: 1, time });
|
||||||
collector.once('end', (interactions, reason) => {
|
collector.once('end', interactions => {
|
||||||
if (options.errors && options.errors.includes(reason)) reject(interactions);
|
const interaction = interactions.first();
|
||||||
else resolve(interactions);
|
if (!interaction) reject(new Error('INTERACTION_COLLECTOR_TIMEOUT'));
|
||||||
|
else resolve(interaction);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class TextChannel extends GuildChannel {
|
|||||||
createMessageCollector() {}
|
createMessageCollector() {}
|
||||||
awaitMessages() {}
|
awaitMessages() {}
|
||||||
createMessageComponentInteractionCollector() {}
|
createMessageComponentInteractionCollector() {}
|
||||||
awaitMessageComponentInteractions() {}
|
awaitMessageComponentInteraction() {}
|
||||||
bulkDelete() {}
|
bulkDelete() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ class TextBasedChannel {
|
|||||||
'createMessageCollector',
|
'createMessageCollector',
|
||||||
'awaitMessages',
|
'awaitMessages',
|
||||||
'createMessageComponentInteractionCollector',
|
'createMessageComponentInteractionCollector',
|
||||||
'awaitMessageComponentInteractions',
|
'awaitMessageComponentInteraction',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (const prop of props) {
|
for (const prop of props) {
|
||||||
|
|||||||
Reference in New Issue
Block a user