Update Message.js
This commit is contained in:
parent
5c92f0de33
commit
90085a99ce
@ -1076,10 +1076,10 @@ class Message extends Base {
|
|||||||
* @returns {Promise<Message|Modal>}
|
* @returns {Promise<Message|Modal>}
|
||||||
*/
|
*/
|
||||||
selectMenu(menu, values = []) {
|
selectMenu(menu, values = []) {
|
||||||
let selectMenu;
|
let selectMenu = menu;
|
||||||
if (/[0-4]/.test(menu)) {
|
if (/[0-4]/.test(menu)) {
|
||||||
selectMenu = this.components[menu]?.components[0];
|
selectMenu = this.components[menu]?.components[0];
|
||||||
} else {
|
} else if (typeof menu == 'string') {
|
||||||
selectMenu = this.components
|
selectMenu = this.components
|
||||||
.flatMap(row => row.components)
|
.flatMap(row => row.components)
|
||||||
.find(
|
.find(
|
||||||
@ -1092,7 +1092,7 @@ class Message extends Base {
|
|||||||
if (values.length < selectMenu.minValues) {
|
if (values.length < selectMenu.minValues) {
|
||||||
throw new RangeError(`[SELECT_MENU_MIN_VALUES] The minimum number of values is ${selectMenu.minValues}`);
|
throw new RangeError(`[SELECT_MENU_MIN_VALUES] The minimum number of values is ${selectMenu.minValues}`);
|
||||||
}
|
}
|
||||||
if (values.length > selectMenu.maxValues) {
|
if (values.length > selectMenu?.maxValues) {
|
||||||
throw new RangeError(`[SELECT_MENU_MAX_VALUES] The maximum number of values is ${selectMenu.maxValues}`);
|
throw new RangeError(`[SELECT_MENU_MAX_VALUES] The maximum number of values is ${selectMenu.maxValues}`);
|
||||||
}
|
}
|
||||||
values = values.map(value => {
|
values = values.map(value => {
|
||||||
|
Loading…
Reference in New Issue
Block a user