#Variable ActionRowBuilder Options
15 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
yes, you can call the addOptions multiple times
but the number of users would change per run. Is there a way for it to automatically detect how many lines I need?
yes, exactly the same way you know who to kick
we just did a map for that with a new line for each one
and?
If I map addOptions will it add a new option for every user?
yes, map runs the function you pass for every element (and returns an array of results of each call)
if you call addOptions inside of that map, it will run for every element in the array/collection
lemme try it real quick
This is the code I have. If it isn't clear, arrays and maps hurt my brain still
// To kick list
else if (subCommand === 'to_kick') {
await interaction.deferReply({
ephemeral: true,
});
const oneDay = 1000 * 60 * 60 * 24;
const Guild = await interaction.guild;
const Members = await Guild.members.cache;
let msg = '';
for (const memberMap of Members) {
const member = memberMap[1];
// console.log(member[1]);
// if (await member)
if (await member.roles.cache.has(DesignatedConsts.UnverifRole)) {
const KickAt = member.joinedTimestamp + oneDay;
if (await KickAt < Date.now() && !await member.roles.cache.has(DesignatedConsts.ExtendRole)) {
msg = msg + `ID: ${member.user.id} ${member.user.tag}\n`;
const row = new ActionRowBuilder()
.addComponents(
new SelectMenuBuilder()
.setCustomId('userToKick')
.setPlaceholder('No Users Selected.')
.setMinValues(1)
.addOptions(
memberMap.map(map => { return { label: memberMap.member.user.tag, description: memberMap.member.user.id };}),
),
);
}
}
}```