code:
const { ContextMenuCommandBuilder, ApplicationCommandType } = require("discord.js")
module.exports = {
data: new ContextMenuCommandBuilder()
.setName("Test")
.setType(ApplicationCommandType.User),
async run (interaction) {
await interaction.reply({ content: "This worked", ephemeral: true })
}
}```
interactionCreate event:
```js
client.on('interactionCreate', async (interaction) => {
if (!interaction.isUserContextMenuCommand()) return;
const { commands } = client
const { commandName } = interaction
const contextCommand = commands.get(commandName)
if(!contextCommand) return;
console.log(interaction.commandId)
try {
await contextCommand.run(interaction)
} catch (e) {
console.log(e)
}
});```
Issue:
bot returns `The application did not respond`
For some reason `console.log(contextCommand)` doesn't return anything