From 90085a99ce99613aafb8014b0feabf70eda28570 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Sun, 3 Mar 2024 15:16:55 +0700 Subject: [PATCH] Update Message.js --- src/structures/Message.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index f11d4c1..f7afe6a 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -1076,10 +1076,10 @@ class Message extends Base { * @returns {Promise} */ selectMenu(menu, values = []) { - let selectMenu; + let selectMenu = menu; if (/[0-4]/.test(menu)) { selectMenu = this.components[menu]?.components[0]; - } else { + } else if (typeof menu == 'string') { selectMenu = this.components .flatMap(row => row.components) .find( @@ -1092,7 +1092,7 @@ class Message extends Base { if (values.length < 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}`); } values = values.map(value => {