@kevlid/discordmenus 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/handle/component.js +4 -2
package/package.json
CHANGED
package/src/handle/component.js
CHANGED
|
@@ -361,9 +361,11 @@ async function handleComponent(interaction, menu, menu_key, renderMenu) {
|
|
|
361
361
|
action === OptionTypes.ChannelSelect
|
|
362
362
|
) {
|
|
363
363
|
const optionKey = values[0];
|
|
364
|
-
const selected = interactionData.values
|
|
364
|
+
const selected = Array.isArray(interactionData.values) ? interactionData.values : [];
|
|
365
365
|
const opt = menu.getOption(category, page, optionKey);
|
|
366
|
-
const
|
|
366
|
+
const maxSel = Number(opt?.maxValues);
|
|
367
|
+
const multi = Number.isFinite(maxSel) && maxSel > 1;
|
|
368
|
+
const saveValue = multi ? [...selected] : selected[0] ?? null;
|
|
367
369
|
await menu.save(optionKey, saveValue, { guildId, userId });
|
|
368
370
|
result = updateMessage(
|
|
369
371
|
await renderMenu(menu_key, { category, index: page, userId, guildId }),
|