#Help me with subcommands for slash

4 messages · Page 1 of 1 (latest)

junior mica
#

This is my code:

const { EmbedBuilder } = require("discord.js");

module.exports = {
    name: 'savedplaylist',
    description: "Get the songs in the saved playlist",
    showHelp: false,

    execute({ client, inter }) {
        fs.readdir('./savedplaylist', (err, files) => {
      if (err) console.error(err);
      else {
        const fileList = files
          .map((file, index) => `${index + 1}. ${file.split('.').slice(0, -1).join('.')}`)
          .join('\n');

        const embed = new EmbedBuilder()
        .setColor('#ff0000')
        .setTitle('List of the saved playlist by the owner')
        .setDescription(`\n${fileList}`)

        inter.reply({ embeds: [embed] });
      }
    });
  },
};```
i want to add a subcommand named: remove, that has other fonctionaly than the main command
wheat drift
#

• 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.

junior mica
#

node version: 18.13

#

discord.js v14.7.1