#context menus not working

1 messages · Page 1 of 1 (latest)

true belfry

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