"Unkown command" when using context command
Pastebin
const commands = [ new SlashCommandBuilder() .setName("dm") ...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
8 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 OP
context commands are still commands, so it enters the first branch and then the default
rather than the else if
if you want to check for slash commands, #isChatInputCommand is the guard for that
:method: BaseInteraction#isChatInputCommand()
@14.16.2
Indicates whether this interaction is a ChatInputCommandInteraction.Pastebin
async function handleInteraction(interaction) { // Check if the us...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
else if like this?
stop doing, start reading
your structure is
message context menu commands, are still commands so they will enter the first branch (
if
) and get lost in there, because none of the cases match
if you just want to match against chat input commands, use this one insteadmb mb sorry
WORKEDDD!!!!!!!11
ILYYY