Fetching / Getting the id of a subcommand in a subcommandgroup

So im trying to make a fully dynamic help embed which shows each command with their description. I need the id to make the commands clickable (like this: </commandname:831874384724> ) all the "normal" commands are shown as they should. But 2 commands, those with subcommandgroups are not clickable. So back to the question does anyone know how to fetch the command ids i read through the docs but didnt find anything regarding ids in subcommands. Node v20.9.0 Discord.js v14.11.0
4 Replies
d.js toolkit
d.js toolkit7mo 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! - Marked as resolved by OP
V3RM1N
V3RM1N7mo ago
well yes and no you are able to copy a command id from a subcommand so somewhere have they have to be stored but where the f are they stored then wait ill give you some code doesnt work well no it works like i said perfectly for those commands with no subcommandgroups
const rest = new REST({ version: '10' }).setToken(process.env.TOKEN)

const commands = await rest.get(
Routes.applicationCommands(process.env.DISCORD_APPLICATION_ID)
)

const helpEmbed = new EmbedBuilder()
.setTitle('Help')
.setDescription('Here are all of my commands\r------------------')
.setAuthor({ name: interaction.client.user.tag })
.setThumbnail(
interaction.client.user.displayAvatarURL({ dynamic: true })
)
.setFooter({ text: `Note: More commands will be added soon` })

commands.forEach((command) => {
if (command.name === 'Info') return
helpEmbed.addFields({
name: `</${command.name}:${command.id}>`
? `</${command.name}:${command.id}>`
: 'No name',
value: `${
command.description ? command.description : 'No description'
}`,
})
})
const rest = new REST({ version: '10' }).setToken(process.env.TOKEN)

const commands = await rest.get(
Routes.applicationCommands(process.env.DISCORD_APPLICATION_ID)
)

const helpEmbed = new EmbedBuilder()
.setTitle('Help')
.setDescription('Here are all of my commands\r------------------')
.setAuthor({ name: interaction.client.user.tag })
.setThumbnail(
interaction.client.user.displayAvatarURL({ dynamic: true })
)
.setFooter({ text: `Note: More commands will be added soon` })

commands.forEach((command) => {
if (command.name === 'Info') return
helpEmbed.addFields({
name: `</${command.name}:${command.id}>`
? `</${command.name}:${command.id}>`
: 'No name',
value: `${
command.description ? command.description : 'No description'
}`,
})
})
V3RM1N
V3RM1N7mo ago
No description
V3RM1N
V3RM1N7mo ago
Thanks man