Encountered error while handling an interaction handler run method for interaction-handler
Been trying to debug an interaction error and haven't been able to figure out why it's erroring. There isn't a single method on the interaction which is allowing me to edit a reply or send a new one and I am confused. The code I am using is code I'm using on other interactions and it works perfectly fine, so I'm confused.
GroupButton.ts button for groups
replyToInteraction.ts Interaction util for my help command
interactionReplyUtil General utils for interactions
2 Replies
"discord.js": "^14.14.1",
And it is almost a direct copy of this which does work
DuckRefreshButton.ts the button
replyToInteration.ts for the duck command
Still having this issue and haven't figured out why just yet
I tried a more basic approach by having the button handle a specific interaction.
No luck, same error. For those unaware, I have a wrapper on interaction handler that allows me to run preconditions through interactions.
Weirdly enough I know how to stop the error, my interaction handler that runs preconditions on the interaction is the reason it's erroring. It doesn't error on my other interactions only in this specific scenario. I don't know why it's causing an unknown interaction error, if anyone knows anything about this error or wants to help please hmu
For whatever reason if I send a reply immediately in the parse
function of sapphire's interaction handler before it's sent to mine, it stops the error. :BRUH:You may want to review our docs on interaction handlers. The idea is that in
parse
you only define if the interaction handler should run for that particular interactionCreate
event and maybe some preparing data (but do that after rejecting it for the incorrect interactionCreate
!) and then send replies in run
. https://sapphirejs.dev/docs/Guide/interaction-handlers/what-are-they
Every interaction handler must have a parse and run method.
As for how to send a reply from an interaction handler, if you want some examples look at the docs linked above, or take an example from another bot such as @Dragonite (https://github.com/favware/dragonite)
Your code is a bit hard to follow along because of the various utility functions wrapping functionality so I can't really make rhyme or reason of a lot of it.
Also you asked in this #discordjs-support but we also have #sapphire-support btw 🙂Sapphire Framework
What are they? | Sapphire
These are interaction handlers! A simple class you can extend to handle almost all the interactions you may receive in
GitHub
GitHub - favware/dragonite: A Pokémon information Discord bot built...
A Pokémon information Discord bot built around Discord Interactions - favware/dragonite