fix: select menu not found
This commit is contained in:
parent
b44663cd47
commit
5cc8aeffad
@ -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);
|
||||
}
|
||||
//
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user