how to this type of advanced help menu

https://srcb.in/aatGdT2Ff5 https://srcb.in/IrPCEw0UZu
const commands = interaction.client.commands.filter(x => x.data.name == interaction.commandName).map((x) => x.data.options.map((c) => '`' + c.name + '` :arrow_right: :fdot2: ' + c.description).join("\n"));
const commands = interaction.client.commands.filter(x => x.data.name == interaction.commandName).map((x) => x.data.options.map((c) => '`' + c.name + '` :arrow_right: :fdot2: ' + c.description).join("\n"));
This is my cmd handler It gives when we type /afk help it gives afk related commands such that i need the commands add on selection menu what i do for it
8 Replies
d.js toolkit
d.js toolkit17mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
hehebrd !!
hehebrd !!OP17mo ago
Discord.js 14.12 Node 17.9.1 Heey anyone here
Not So Marv
Not So Marv17mo ago
To build a StringSelectMenu: implement a new menu with: const menu = new StringSelectMenuBuilder() and make sure you require StringSelectMenuBuilder from discord.js Personally, I would have a single help command rather than setting a help argument in each command. give it a custom_id, placeholder (optional), and options like this
//require required classes
const { StringSelectMenuBuilder, EmbedBuilder } = require('discord.js');
//create a new menu and pass in the needed data
const menu = new StringSelectMenuBuilder({
custom_id: 'help-menu', //set your select menus custom id
placeholder: 'Select an option to view commands in different categories.', //This is what is displayed before making a selection.
//DEFINE MENU OPTIONS
options: [
{
name: 'afk',
value: 'afk',
emoji: '✔' //optional
},
//add more options for more items in the menu (UP TO 25 IN TOTAL - NO MORE!)
{}
]
});
//reply to the interaction.
//require required classes
const { StringSelectMenuBuilder, EmbedBuilder } = require('discord.js');
//create a new menu and pass in the needed data
const menu = new StringSelectMenuBuilder({
custom_id: 'help-menu', //set your select menus custom id
placeholder: 'Select an option to view commands in different categories.', //This is what is displayed before making a selection.
//DEFINE MENU OPTIONS
options: [
{
name: 'afk',
value: 'afk',
emoji: '✔' //optional
},
//add more options for more items in the menu (UP TO 25 IN TOTAL - NO MORE!)
{}
]
});
//reply to the interaction.
hehebrd !!
hehebrd !!OP17mo ago
Bro but how to get the afk commands it will give that?
Not So Marv
Not So Marv17mo ago
So run the help command and send the menu with the overview embed. When you select an option in the menu, you need to edit the original embed with the new embed and resend the menu. When you select an option, discord reads a menu selection as [interaction.values] so
const [category] = interaction.values; //select the first item in the array
await interaction.update({ embeds: [EMBED_OF_SELECTED_OPTION], components: [menu] })
const [category] = interaction.values; //select the first item in the array
await interaction.update({ embeds: [EMBED_OF_SELECTED_OPTION], components: [menu] })
hehebrd !!
hehebrd !!OP17mo ago
What i want to do 1st?
Not So Marv
Not So Marv17mo ago
create the menu and overview embed and send it
hehebrd !!
hehebrd !!OP17mo ago
Ok
const Discord = require('discord.js');

module.exports = async (client, interaction, args) => {

const menu = new Discord.ActionRowBuilder()
.addComponents(
new Discord.StringSelectMenuBuilder()
.setCustomId('help-menu')
.setPlaceholder('Select Something')
.addOptions([
{
label: `Afk`,
value: "afk",
},
{ label: `announcement`,
value: "announcement",

},
]),
);

const embed = new Discord.EmbedBuilder()
.setDecsription(`afk`)

const afk = interaction.values; //select the first item in the array
await interaction.update({ embeds: [embed], components: [menu] })
const Discord = require('discord.js');

module.exports = async (client, interaction, args) => {

const menu = new Discord.ActionRowBuilder()
.addComponents(
new Discord.StringSelectMenuBuilder()
.setCustomId('help-menu')
.setPlaceholder('Select Something')
.addOptions([
{
label: `Afk`,
value: "afk",
},
{ label: `announcement`,
value: "announcement",

},
]),
);

const embed = new Discord.EmbedBuilder()
.setDecsription(`afk`)

const afk = interaction.values; //select the first item in the array
await interaction.update({ embeds: [embed], components: [menu] })
Like this want to do? <@371759410009341952>
Want results from more Discord servers?
Add your server