"Unkown command" when using context command

so heres my code i've no idea why the context command says unkown 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
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! - Marked as resolved by OP
Cloud
CloudOP3mo ago
No description
souji
souji3mo ago
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
d.js docs
d.js docs3mo ago
:method: BaseInteraction#isChatInputCommand() @14.16.2 Indicates whether this interaction is a ChatInputCommandInteraction.
Cloud
CloudOP3mo ago
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.
Cloud
CloudOP3mo ago
else if like this?
souji
souji3mo ago
stop doing, start reading your structure is
if iscommand:
...
else if is contextmenucommand:
...
if iscommand:
...
else if is contextmenucommand:
...
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 instead
Cloud
CloudOP3mo ago
mb mb sorry WORKEDDD!!!!!!!11 ILYYY
Want results from more Discord servers?
Add your server