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•8mo 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👑•8mo ago
good idea, do I import Interaction from the framework?
Lioness100
Lioness100•8mo ago
It's from discord.js
-Carlosđź‘‘
-Carlos👑•8mo 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•8mo ago
Sorry, technically the class is BaseInteraction
-Carlosđź‘‘
-Carlos👑•8mo 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•8mo ago
how would it send the embeds replying to the command if there was no command
-Carlosđź‘‘
-Carlos👑•8mo ago
wdym
Lioness100
Lioness100•8mo ago
wdym
-Carlosđź‘‘
-Carlos👑•8mo ago
wdym there was not a command
Lioness100
Lioness100•8mo ago
I mean command interaction
-Carlosđź‘‘
-Carlos👑•8mo ago
i was talking about message commands
Lioness100
Lioness100•8mo ago
Show your updated code
-Carlosđź‘‘
-Carlos👑•8mo 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•8mo ago
And the function?
-Carlosđź‘‘
-Carlos👑•8mo 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.