feat: new select menu (v2)

#9174 djs
This commit is contained in:
Elysia
2023-02-28 13:42:35 +07:00
parent ba22a5f550
commit 808adeb016
8 changed files with 392 additions and 81 deletions

View File

@@ -1620,29 +1620,37 @@ exports.InteractionResponseTypes = createEnum([
* The type of a message component
* * ACTION_ROW
* * BUTTON
* * STRING_SELECT
* * TEXT_INPUT
* * STRING_SELECT
* * USER_SELECT
* * ROLE_SELECT
* * MENTIONABLE_SELECT
* * CHANNEL_SELECT
* * SELECT_MENU (deprecated)
* @typedef {string} MessageComponentType
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object-component-types}
*/
exports.MessageComponentTypes = createEnum([
null,
'ACTION_ROW',
'BUTTON',
'STRING_SELECT',
'TEXT_INPUT',
'USER_SELECT',
'ROLE_SELECT',
'MENTIONABLE_SELECT',
'CHANNEL_SELECT',
]);
exports.MessageComponentTypes = {
...createEnum([
null,
'ACTION_ROW',
'BUTTON',
'STRING_SELECT',
'TEXT_INPUT',
'USER_SELECT',
'ROLE_SELECT',
'MENTIONABLE_SELECT',
'CHANNEL_SELECT',
]),
/** @deprecated Use `STRING_SELECT` instead */
SELECT_MENU: 3,
/** @deprecated Use `STRING_SELECT` instead */
3: 'SELECT_MENU',
};
/**
* The types of components that are select menus. The available types are:
* * SELECT_MENU (deprecated)
* * STRING_MENU
* * USER_SELECT
* * ROLE_SELECT
@@ -1651,15 +1659,19 @@ exports.MessageComponentTypes = createEnum([
* @typedef {string} SelectMenuComponentType
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object-component-types}
*/
exports.SelectMenuComponentTypes = createEnum([
...new Array(3).fill(null),
'STRING_MENU',
null,
'USER_SELECT',
'ROLE_SELECT',
'MENTIONABLE_SELECT',
'CHANNEL_SELECT',
]);
exports.SelectMenuComponentTypes = {
...createEnum([
...new Array(3).fill(null),
'STRING_MENU',
null,
'USER_SELECT',
'ROLE_SELECT',
'MENTIONABLE_SELECT',
'CHANNEL_SELECT',
]),
/** @deprecated Use `STRING_SELECT` instead */
SELECT_MENU: 3,
};
/**
* The style of a message button
@@ -1861,7 +1873,7 @@ function createEnum(keys) {
* @property {Object<MembershipState, number>} MembershipStates The value set for a team members membership state.
* @property {Object<MessageButtonStyle, number>} MessageButtonStyles The style of a message button.
* @property {Object<MessageComponentType, number>} MessageComponentTypes The type of a message component.
* @property {Object<SelectMenuComponentType, number>} SelectMenuComponentTypes The type of any select menu
* @property {Object<SelectMenuComponentType, number>} SelectMenuComponentTypes The type of any select menu.
* @property {Object<MFALevel, number>} MFALevels The required MFA level for a guild.
* @property {Object<NSFWLevel, number>} NSFWLevels NSFW level of a guild.
* @property {Opcodes} Opcodes The types of Opcodes sent to the Gateway.