#seemingly incorrect type error?
36 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
It's an abstract type, You could use ChatInputCommandInteraction | ContextMenuCommandInteraction
Its fixed if I add |CommandInteraction but I dont feel like I should have to do that
Oh
It's sole purpose is to be extended by those interfaces
Sorry im not very familiar with typescript types, what is an abstract type?
Are those all interactions with .reply?
Well there are button interactions and select menu interactions too
In my specific case I do not know the type of interaction that will be given to me
So it must support all types that can be replied too with embeds and none that dont support .reply or cannot be responded with embeds
RepliableInteraction contains interfaces that do not have reply(), like autocomplete interactions
The naming implies otherwise but noted
They can all be replied to, just that it's not called reply on each of them
Ah ok also what would you say would be the best way to support all (at least commonly used) repliable interactions
Well what interaction types are you wanting to reply to?
Any the user provides
Buttons, Selectmenus, commands, ect
Anything you could reply with an embed too, or at least the common ones you reply with embeds too
You should handle each interaction type differently, I guess. Context menus and slash commands can be the same, if you want. Autocomplete interactions cannot be responded to with an embed though
Buttons also use reply
My class is an extended version of the discord embed builder for the project in my about me
Thats why I need to support all the interactions that could be responded too with an embed
Tldr, Is there a more efficient/used way of doing that or should I use use CommandInteraction|ButtonInteraction|SelectMenuInteraction|ect, ect
You should use that yeah
This'll be enough
if (interaction.isRepliable()) {
if (interaction.isAutocomplete()) {
// Handle autocomplete interactions.
} else {
interaction.reply("...");
}
}
What even are AutoComplete interactions?
They are used to populate a list of choices in slash command options
I dont think ill be needing an embed for that
Exactly so its not really needed for an extended embedbuilder class
Every time you type into there, the list is populated. You're sending autocomplete interactions every time you type there