ChatInputCommandInteraction

How to correctly define ChatInputCommandInteraction, I tried importing it from the framework, however is returned this: TypeError: Right-hand side of 'instanceof' is not an object I'm trying to do this: I have a createError function, which sends a embed with the provided text and then deletes the message and the embed after some seconds, however I want it only reply if the variable is a interaction instance. Here's the createError code: https://pastebin.com/nNHV5Xr4 isInteractionInstance function: https://pastebin.com/fKsTMAUi
16 Replies
Lioness100
Lioness100•13mo ago
ChatInputCommandInteraction is a type, not a class. CommandInteraction is a class, though. You might want to use Interaction though, to handle buttons & etc
-Carlos👑
-Carlos👑OP•13mo ago
good idea, do I import Interaction from the framework?
Lioness100
Lioness100•13mo ago
It's from discord.js
-Carlos👑
-Carlos👑OP•13mo ago
TypeError: Right-hand side of 'instanceof' is not an object
const { Interaction } = require("discord.js");
return variable instanceof Interaction;
const { Interaction } = require("discord.js");
return variable instanceof Interaction;
Lioness100
Lioness100•13mo ago
Sorry, technically the class is BaseInteraction
-Carlos👑
-Carlos👑OP•13mo ago
it worked, however when a message object is provided it sends the embeds replying to the command, when it should send the embed (not replying), then delete the command and the embeds 3 seconds after
Lioness100
Lioness100•13mo ago
how would it send the embeds replying to the command if there was no command
-Carlos👑
-Carlos👑OP•13mo ago
wdym
Lioness100
Lioness100•13mo ago
wdym
-Carlos👑
-Carlos👑OP•13mo ago
wdym there was not a command
Lioness100
Lioness100•13mo ago
I mean command interaction
-Carlos👑
-Carlos👑OP•13mo ago
i was talking about message commands
Lioness100
Lioness100•13mo ago
Show your updated code
-Carlos👑
-Carlos👑OP•13mo ago
Pastebin
createError function - Pastebin.com
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.
Lioness100
Lioness100•13mo ago
And the function?
-Carlos👑
-Carlos👑OP•13mo ago
Pastebin
isInteractionInstance function - Pastebin.com
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.
Want results from more Discord servers?
Add your server