feat(MessageSelectMenu): droppybois (#5692)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
monbrey
2021-06-25 07:25:16 +10:00
committed by GitHub
parent d984ac9d09
commit e5fcf0bee5
11 changed files with 336 additions and 14 deletions

70
typings/index.d.ts vendored
View File

@@ -82,6 +82,7 @@ declare enum MessageButtonStyles {
declare enum MessageComponentTypes {
ACTION_ROW = 1,
BUTTON = 2,
SELECT_MENU = 3,
}
declare enum MFALevels {
@@ -1176,6 +1177,7 @@ declare module 'discord.js' {
public isButton(): this is ButtonInteraction;
public isCommand(): this is CommandInteraction;
public isMessageComponent(): this is MessageComponentInteraction;
public isSelectMenu(): this is SelectMenuInteraction;
}
export class InteractionWebhook extends PartialWebhookMixin() {
@@ -1531,6 +1533,29 @@ declare module 'discord.js' {
public toJSON(): unknown;
}
class MessageSelectMenu extends BaseMessageComponent {
constructor(data?: MessageSelectMenu | MessageSelectMenuOptions);
public customID: string | null;
public disabled: boolean;
public maxValues: number | null;
public minValues: number | null;
public options: MessageSelectOption[];
public placeholder: string | null;
public type: 'SELECT_MENU';
public addOptions(options: MessageSelectOptionData[] | MessageSelectOptionData[][]): this;
public setCustomID(customID: string): this;
public setDisabled(disabled: boolean): this;
public setMaxValues(maxValues: number): this;
public setMinValues(minValues: number): this;
public setPlaceholder(placeholder: string): this;
public spliceOptions(
index: number,
deleteCount: number,
...options: MessageSelectOptionData[] | MessageSelectOptionData[][]
): this;
public toJSON(): unknown;
}
export class NewsChannel extends TextBasedChannel(GuildChannel) {
constructor(guild: Guild, data?: unknown);
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
@@ -1693,6 +1718,11 @@ declare module 'discord.js' {
public static comparePositions(role1: Role, role2: Role): number;
}
export class SelectMenuInteraction extends MessageComponentInteraction {
public componentType: 'SELECT_MENU';
public values: string[] | null;
}
export class Shard extends EventEmitter {
constructor(manager: ShardingManager, id: number);
private _evals: Map<string, Promise<any>>;
@@ -3182,6 +3212,7 @@ declare module 'discord.js' {
User: typeof User;
CommandInteraction: typeof CommandInteraction;
ButtonInteraction: typeof ButtonInteraction;
SelectMenuInteraction: typeof SelectMenuInteraction;
}
interface FetchApplicationCommandOptions extends BaseFetchOptions {
@@ -3572,9 +3603,9 @@ declare module 'discord.js' {
type MembershipState = keyof typeof MembershipStates;
type MessageActionRowComponent = MessageButton;
type MessageActionRowComponent = MessageButton | MessageSelectMenu;
type MessageActionRowComponentOptions = MessageButtonOptions;
type MessageActionRowComponentOptions = MessageButtonOptions | MessageSelectMenuOptions;
type MessageActionRowComponentResolvable = MessageActionRowComponent | MessageActionRowComponentOptions;
@@ -3587,6 +3618,8 @@ declare module 'discord.js' {
type: number;
}
type MessageAdditions = MessageEmbed | MessageAttachment | (MessageEmbed | MessageAttachment)[];
interface MessageButtonOptions extends BaseMessageComponentOptions {
customID?: string;
disabled?: boolean;
@@ -3605,7 +3638,7 @@ declare module 'discord.js' {
maxProcessed?: number;
}
type MessageComponent = BaseMessageComponent | MessageActionRow | MessageButton;
type MessageComponent = BaseMessageComponent | MessageActionRow | MessageButton | MessageSelectMenu;
interface MessageComponentInteractionCollectorOptions extends CollectorOptions {
max?: number;
@@ -3613,7 +3646,11 @@ declare module 'discord.js' {
maxUsers?: number;
}
type MessageComponentOptions = BaseMessageComponentOptions | MessageActionRowOptions | MessageButtonOptions;
type MessageComponentOptions =
| BaseMessageComponentOptions
| MessageActionRowOptions
| MessageButtonOptions
| MessageSelectMenuOptions;
type MessageComponentType = keyof typeof MessageComponentTypes;
@@ -3750,6 +3787,31 @@ declare module 'discord.js' {
type MessageResolvable = Message | Snowflake;
interface MessageSelectMenuOptions extends BaseMessageComponentOptions {
customID?: string;
disabled?: boolean;
maxValues?: number;
minValues?: number;
options?: MessageSelectOptionData[];
placeholder?: string;
}
interface MessageSelectOption {
default: boolean;
description: string | null;
emoji: RawEmoji | null;
label: string;
value: string;
}
interface MessageSelectOptionData {
default?: boolean;
description?: string;
emoji?: EmojiIdentifierResolvable;
label: string;
value: string;
}
type MessageTarget =
| Interaction
| InteractionWebhook