#It happens when I have more than 1
1 messages · Page 1 of 1 (latest)
right
so what should I do
are you on a linux machine?
no, windows
lemme just paste this here for context
const { options, guild, member } = interaction;
let guildData = await Guild.findOne({Guild: guild.id});
let index = 1;
function shopList(name) {
if (guildData.shop.length) {
return `${index++}. ${name}`
}
}
let shopArray = [
{
lable: "sussy baka",
description: "is sus 24/7",
value: 420
}
];
let selectMenuThingy = new SelectMenuBuilder()
.setCustomId('select')
.setPlaceholder('Nothing selected');
shopArray.forEach(shop => selectMenuThingy.addOptions({
label: shop.lable,
description: shop.description,
value: shop.value
}));
const selectMenu = new ActionRowBuilder().addComponents(selectMenuThingy)
So you have shop.value, but I do not store it in my array
unfortunately not, I have only this
so value is required arg in .addOption()
in docs there is an example
like first, second option
alright
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
right
so value is used as an identity marker
const { options, guild, member } = interaction;
let guildData = await Guild.findOne({Guild: guild.id});
let index = 1;
function shopList(name) {
if (guildData.shop.length) {
return `${index++}. ${name}`
}
}
let shopArray = [
{
lable: "sussy baka",
description: "is sus 24/7"
}
];
let selectMenuThingy = new SelectMenuBuilder()
.setCustomId('select')
.setPlaceholder('Nothing selected');
shopArray.forEach(shop => selectMenuThingy.addOptions({
label: shop.lable,
description: shop.description,
value: shop.lable
}));
const selectMenu = new ActionRowBuilder().addComponents(selectMenuThingy)
this should work
@rugged verge Hello, I have one more question. After user chooses something from this list, how can I get his choice and then do something with it?
please read the docs
I know, but I don't know how to get his choice because I have .forEach
so I can't for example do
if (selected === 'ping')
so I can't get the value
of what user has chosen