#seemingly incorrect type error?

36 messages · Page 1 of 1 (latest)

calm compass
#

Why is CommandInteraction Throwing an error with RepliableInteraction, A commandinteraction is repliable?

#

• 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.

lethal geode
#

It's an abstract type, You could use ChatInputCommandInteraction | ContextMenuCommandInteraction

calm compass
#

Its fixed if I add |CommandInteraction but I dont feel like I should have to do that

lethal geode
#

It's sole purpose is to be extended by those interfaces

calm compass
#

Sorry im not very familiar with typescript types, what is an abstract type?

calm compass
lethal geode
#

Well there are button interactions and select menu interactions too

calm compass
#

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

lethal geode
#

RepliableInteraction contains interfaces that do not have reply(), like autocomplete interactions

calm compass
#

The naming implies otherwise but noted

lethal geode
#

They can all be replied to, just that it's not called reply on each of them

calm compass
#

Ah ok also what would you say would be the best way to support all (at least commonly used) repliable interactions

lethal geode
#

Well what interaction types are you wanting to reply to?

calm compass
#

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

lethal geode
#

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

calm compass
#

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

lethal geode
#

You should use that yeah

calm compass
#

Ok well thank you for your time!

#

Its appreciated

lethal geode
#

This'll be enough

if (interaction.isRepliable()) {
  if (interaction.isAutocomplete()) {
    // Handle autocomplete interactions.
  } else {
    interaction.reply("...");
  }
}
calm compass
#

What even are AutoComplete interactions?

lethal geode
#

They are used to populate a list of choices in slash command options

calm compass
#

I dont think ill be needing an embed for that

lethal geode
#

Nah lol

#

Not possible

#

</discorddocs:957810960867950622> is an example

calm compass
#

Exactly so its not really needed for an extended embedbuilder class

lethal geode
#

Every time you type into there, the list is populated. You're sending autocomplete interactions every time you type there