From 5cc8aeffadc20a146afd89917f283802aeb0835b Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Thu, 16 Mar 2023 23:41:10 +0700 Subject: [PATCH] fix: select menu not found --- src/structures/Message.js | 11 +++++++++-- src/structures/MessageSelectMenu.js | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 90931d7..78610b5 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -1133,7 +1133,14 @@ class Message extends Base { const menuAll = this.components .flatMap(row => row.components) .filter(b => - ['STRING_SELECT', 'USER_SELECT', 'ROLE_SELECT', 'MENTIONABLE_SELECT', 'CHANNEL_SELECT'].includes(b.type), + [ + 'STRING_SELECT', + 'USER_SELECT', + 'ROLE_SELECT', + 'MENTIONABLE_SELECT', + 'CHANNEL_SELECT', + 'SELECT_MENU', + ].includes(b.type), ); if (menuAll.length == 0) throw new TypeError('MENU_NOT_FOUND'); if (menuID) { @@ -1142,7 +1149,7 @@ class Message extends Base { menuID = menuAll[0]; } } - if (!menuID.type.includes('_SELECT')) throw new TypeError('MENU_NOT_FOUND'); + if (!menuID.type.includes('SELECT')) throw new TypeError('MENU_NOT_FOUND'); return menuID.select(this, Array.isArray(menuID) ? menuID : options); } // diff --git a/src/structures/MessageSelectMenu.js b/src/structures/MessageSelectMenu.js index 03db2e3..2270d99 100644 --- a/src/structures/MessageSelectMenu.js +++ b/src/structures/MessageSelectMenu.js @@ -293,6 +293,7 @@ class MessageSelectMenu extends BaseMessageComponent { }); const parseValues = value => { switch (this.type) { + case 'SELECT_MENU': case 'STRING_SELECT': { if (typeof value !== 'string') throw new TypeError('[INVALID_VALUE] Please pass a string value'); const value_ = this.options.find(obj => obj.value === value || obj.label === value);