Command Map

async execute(interaction, client) {
const { commands } = interaction.client;
applog('error', commands.map(command => command.name).join(', '))
const embed = new EmbedBuilder() .setTitle('Here's a list of all my commands:') .addFields( { name: 'Commands:', value: commands.map(command => command.name).join(', ') }, { name: '\u200B', value: For help on a specific command send: \help [command name]``} ) await interaction.reply({ embeds: [embed] }).then(msg => { setTimeout(() => msg.delete(), 15000) }); }, Where is my mistake? The only response in the console is: , , , , , Thank you very much for your help
3 Replies
d.js toolkit
d.js toolkit9mo 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
</PixelPatron>
</PixelPatron>OP9mo ago
No description
</PixelPatron>
</PixelPatron>OP9mo ago
Thanks to @Mikael . We finally found a way together 🙂
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
const stringifyBigInts = (key, value) => {
if (typeof value === 'bigint') {
return value.toString();
}
return value;
};

const { commands } = interaction.client;

const commandList = commands.map(command => {
return {
name: command.data.name || "No name provided",
usage: command.data.usage || "No usage provided",
description: command.data.description || "No description provided"
};
});

const embed = new EmbedBuilder()
.setTitle("Here's a list of all my commands:")
.addFields(
commandList.map(command => ({
name: command.usage,
value: command.description
}))
);

await interaction.editReply({ embeds: [embed], ephemeral: true });

},
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
const stringifyBigInts = (key, value) => {
if (typeof value === 'bigint') {
return value.toString();
}
return value;
};

const { commands } = interaction.client;

const commandList = commands.map(command => {
return {
name: command.data.name || "No name provided",
usage: command.data.usage || "No usage provided",
description: command.data.description || "No description provided"
};
});

const embed = new EmbedBuilder()
.setTitle("Here's a list of all my commands:")
.addFields(
commandList.map(command => ({
name: command.usage,
value: command.description
}))
);

await interaction.editReply({ embeds: [embed], ephemeral: true });

},

Did you find this page helpful?