Interaction handlers problem

hello, I have a problem when creating modals interaction, always get weird error logs (attachment 2) I don't know, what should I do? i need to create some registration sections (which is i copy from djs-docs for testing), when user execute command example: /register will show the embedded button, the button is fine, inside button(interaction handler) is the modals code (attachment 1) but when I click submit button, error (attachment 2) https://cdn.discordapp.com/attachments/718032929825226884/1195818811564232824/image.png?ex=65b5600d&is=65a2eb0d&hm=4b65e082e1d923b7af4c00fbf8614fcfbb937c5eb9e081db318542906d900abd& https://cdn.discordapp.com/attachments/718032929825226884/1195818880640225370/image.png?ex=65b5601e&is=65a2eb1e&hm=4b6fe4558ed5fe2f5d5c660c5cd10766b8cf163cdc5f21a22c301f1053c7b68d&
Solution:
Includes will be fine just make sure to return this.some as well. In fact better to do if(condition) return this.some() so you don't have a negated if condition.
Jump to solution
7 Replies
Favna
Favna5mo ago
You need to implement parse in the internation handler and put the customId filter there. That should fix the error because the error is where we read the result from parse. https://www.sapphirejs.dev/docs/Guide/interaction-handlers/what-are-they CC @vladdy way back when you wrote the v4 docs you said it was technically possible to put everything in run but people shouldnt. I fully agree with this statement, but if we want to uphold that it's technically possible to put everything in run then we should check if option is undefined here: https://github.com/sapphiredev/framework/blob/10d03313d7ff1567f753d319dafd8ef88b35de7a/src/lib/structures/InteractionHandlerStore.ts#L33
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
Favna
Favna5mo ago
btw you also have an oudated version of @sapphire/framework installed @Vanity. You seem to have installed v4 when v5 is the latest. I can tell because the path should otherwise be dist/cjs/lib/structures/InteractionHandlerStore.cjs
Favna
Favna5mo ago
@vladdy line 26 from the stacktrace above is option.match:
No description
Vanity
Vanity5mo ago
i dont know there is shappire v5, i need to update after this, okay back to the topic, i just modify parse which is the default is if (interaction.customId !== 'my-awesome-button') return this.none(); but im modify little bit like if (!interaction.customId.includes('my-awesome')) return this.none();, or this is causes the error? lemme try after work
Solution
Favna
Favna5mo ago
Includes will be fine just make sure to return this.some as well. In fact better to do if(condition) return this.some() so you don't have a negated if condition.
Vanity
Vanity5mo ago
thankyou, this fixed my issue, my dist is still in old code i think, when i delete the dist and compile again it fixed my issue
vladdy
vladdy5mo ago
well if its undefined, it means people altered the method we provide a default implementation of parse but yes we need a better-er handler for no return from parse