"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 toolkit2mo 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
Auth
AuthOP2mo ago
No description
souji
souji2mo 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 docs2mo ago
:method: BaseInteraction#isChatInputCommand() @14.16.2 Indicates whether this interaction is a ChatInputCommandInteraction.
Auth
AuthOP2mo 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.
Auth
AuthOP2mo ago
else if like this?
souji
souji2mo 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
Auth
AuthOP2mo ago
mb mb sorry WORKEDDD!!!!!!!11 ILYYY
Want results from more Discord servers?
Add your server