#djs in esm

1 messages · Page 1 of 1 (latest)

half moat
#

can you also just help me with 1 more thing, in ping.js command file

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Replies with Pong!'),
    async execute(interaction) {
        await interaction.reply('Pong!');
    },
};```
 it says `ReferenceError: module is not defined in ES module scope` 
i think `export` is to be used can you just give a template of that, if its not too much trouble... rest I think will be just similar to cjs.
brittle knot
#

You can use export default to export the object, instead of defining your module.exports

half moat
#

thanks. it worked.

half moat
#

@brittle knot can you help me with this too please ? #djs-help-v14 message

only getting error while using .addChoice

half moat
#

nvm, it was a problem of discord, using .addChoices worked fine...