mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
typings: Message#createMessageComponentCollector use MessageComponentInteractionOptions<T> (#6596)
This commit is contained in:
9
typings/index.d.ts
vendored
9
typings/index.d.ts
vendored
@@ -1160,7 +1160,7 @@ type InteractionExtractor<T extends MessageComponentType | MessageComponentTypes
|
|||||||
type MessageCollectorOptionsParams<T extends MessageComponentType | MessageComponentTypes | undefined> =
|
type MessageCollectorOptionsParams<T extends MessageComponentType | MessageComponentTypes | undefined> =
|
||||||
| {
|
| {
|
||||||
componentType?: T;
|
componentType?: T;
|
||||||
} & InteractionCollectorOptions<InteractionExtractor<T>>;
|
} & MessageComponentCollectorOptions<InteractionExtractor<T>>;
|
||||||
|
|
||||||
type AwaitMessageCollectorOptionsParams<T extends MessageComponentType | MessageComponentTypes | undefined> =
|
type AwaitMessageCollectorOptionsParams<T extends MessageComponentType | MessageComponentTypes | undefined> =
|
||||||
| { componentType?: T } & Pick<
|
| { componentType?: T } & Pick<
|
||||||
@@ -4026,15 +4026,16 @@ export interface InteractionCollectorOptions<T extends Interaction> extends Coll
|
|||||||
message?: Message | APIMessage;
|
message?: Message | APIMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ButtonInteractionCollectorOptions extends InteractionCollectorOptions<ButtonInteraction> {
|
export interface ButtonInteractionCollectorOptions extends MessageComponentCollectorOptions<ButtonInteraction> {
|
||||||
componentType: 'BUTTON' | MessageComponentTypes.BUTTON;
|
componentType: 'BUTTON' | MessageComponentTypes.BUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SelectMenuInteractionCollectorOptions extends InteractionCollectorOptions<SelectMenuInteraction> {
|
export interface SelectMenuInteractionCollectorOptions extends MessageComponentCollectorOptions<SelectMenuInteraction> {
|
||||||
componentType: 'SELECT_MENU' | MessageComponentTypes.SELECT_MENU;
|
componentType: 'SELECT_MENU' | MessageComponentTypes.SELECT_MENU;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MessageInteractionCollectorOptions extends InteractionCollectorOptions<MessageComponentInteraction> {
|
export interface MessageInteractionCollectorOptions
|
||||||
|
extends MessageComponentCollectorOptions<MessageComponentInteraction> {
|
||||||
componentType: 'ACTION_ROW' | MessageComponentTypes.ACTION_ROW;
|
componentType: 'ACTION_ROW' | MessageComponentTypes.ACTION_ROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -508,9 +508,14 @@ client.on('messageCreate', message => {
|
|||||||
assertType<InteractionCollector<MessageComponentInteraction>>(defaultCollector);
|
assertType<InteractionCollector<MessageComponentInteraction>>(defaultCollector);
|
||||||
|
|
||||||
// Verify that additional options don't affect default collector types.
|
// Verify that additional options don't affect default collector types.
|
||||||
const semiDefaultCollector = message.createMessageComponentCollector({ interactionType: 'APPLICATION_COMMAND' });
|
const semiDefaultCollector = message.createMessageComponentCollector({ time: 10000 });
|
||||||
assertType<InteractionCollector<MessageComponentInteraction>>(semiDefaultCollector);
|
assertType<InteractionCollector<MessageComponentInteraction>>(semiDefaultCollector);
|
||||||
|
|
||||||
|
// Verify that interaction collector options can't be used.
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
const interactionOptions = message.createMessageComponentCollector({ interactionType: 'APPLICATION_COMMAND' });
|
||||||
|
|
||||||
// Make sure filter parameters are properly inferred.
|
// Make sure filter parameters are properly inferred.
|
||||||
message.createMessageComponentCollector({
|
message.createMessageComponentCollector({
|
||||||
filter: i => {
|
filter: i => {
|
||||||
|
|||||||
Reference in New Issue
Block a user