how to make commands without the slash

i cant find the right thing in the docs and nothing else the internet can someone explain to me how to do it ? is it possible to do it with this kind of syntax ? : module.exports = { data: async execute(interaction) { }, };
7 Replies
d.js toolkit
d.js toolkit3mo 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!
Syjalo
Syjalo3mo ago
Do you want to use slash commands or prefix (message) commands? Your code uses interaction, so I suppose you want to use slash commands, but the title says 'without the slash'
vlad92ii
vlad92ii3mo ago
i want to use prefix commands like !add, !get... I thought that interaction concerned all types of interaction that the customer had with the bot.
Syjalo
Syjalo3mo ago
Prefix commands are old type of commands which were replaced by slash commands. For prefix commands you need to have Message Content privileged intent enabled. By the way Discord doesn't approve the intent to verified bots just for prefix commands. Make a handler for prefix commands isn't that hard. You just need to parse the content of incoming messages to get the command name and arguments, and the rest of the handler is almost the same as for slash commands.
vlad92ii
vlad92ii3mo ago
oohh i think i get it, i need to make a messageHandler file where i'll have multiple conditions for every prefix cmd which will execute each slash command ?
Fyphen
Fyphen3mo ago
Yeah that's right
vlad92ii
vlad92ii3mo ago
thank you sir