problem with interactionCreate
i am receiving this error
/Users/macbookdrink/Desktop/Rito Gomes/events/discord/interactionCreate.js:17
command.run(client, interaction);
^
TypeError: command.run is not a function
at module.exports (/Users/macbookdrink/Desktop/Rito Gomes/events/discord/interactionCreate.js:17:13)
at Client.emit (node:events:514:28)
at InteractionCreateAction.handle (/Users/macbookdrink/node_modules/discord.js/src/client/actions/InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (/Users/macbookdrink/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (/Users/macbookdrink/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketManager.<anonymous> (/Users/macbookdrink/node_modules/discord.js/src/client/websocket/WebSocketManager.js:239:12)
at WebSocketManager.emit (/Users/macbookdrink/node_modules/@vladfrangu/async_event_emitter/dist/index.js:282:31)
at WebSocketShard.<anonymous> (/Users/macbookdrink/node_modules/@discordjs/ws/dist/index.js:1173:51)
at WebSocketShard.emit (/Users/macbookdrink/node_modules/@vladfrangu/async_event_emitter/dist/index.js:282:31)
at WebSocketShard.onMessage (/Users/macbookdrink/node_modules/@discordjs/ws/dist/index.js:988:14)
Node.js v18.17.1
this is my interactionCreate.js
module.exports = (client, interaction) => {
// Verifique se nossa interação é um comando de barra
if (interaction.isCommand()) {
// Obtenha o comando da nossa coleção de comandos de barra
const command = client.interactions.get(interaction.commandName);
// Se o comando não existir, retorne uma mensagem de erro
if (!command) {
return interaction.reply({
content: "Algo deu errado. Talvez o comando não esteja registrado?",
ephemeral: true
});
}
// Execute o comando com o cliente e a interação como parâmetros
command.run(client, interaction);
}
}
and this is what i am executing
https://pastebin.com/UKHd2hnihttps://pastebin.com/UKHd2hni8 Replies
- 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 OPmacbookdrink@ /Users/macbookdrink
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]
Your command doesnt export a run function
what do you mean?
i am newbie on this
do you know how to import and export?
i think i don't know
Then learn js first please as djs is not for beginners, #rules 3 #resources
i mean i have other .js who register this commands