Passing data from one handler to the other
Say I have a Modal Submit Handler and then inside that handler, I create a button for a new reply, and when pressing that button, is there a way I can pass the data received from the modal to the next handler (in this case the Button Interaction Handler)
Thanks in advance 🙂
Solution:Jump to solution
Discord API offers no such option. The only thing you can do is compress it down to a very tiny string and pass it through the custom ID. For example: https://github.com/favware/dragonite/blob/5fb8956c075f4b9b63b8bc5ab47bb89531ce74ed/src/lib/util/utils.ts#L18-L54
18 Replies
Solution
Discord API offers no such option. The only thing you can do is compress it down to a very tiny string and pass it through the custom ID. For example: https://github.com/favware/dragonite/blob/5fb8956c075f4b9b63b8bc5ab47bb89531ce74ed/src/lib/util/utils.ts#L18-L54
Suppose I could just use a Collection?
Actually, yeah, that'll work, thanks
alternatively you can use a collection btw
Is there a max length to the custom IDs?
if you keep that outside of all the interaction handler logic and such
just handle it like a cache basically
100 is the max length
Yeah I'll do it like that
Thank you 🙂
Just be wary that such a collection is in memory. If you want some external cache then Redis is your friend
It's a very temporary process, it'll only get stored in there for a maximum of maybe 3-5 minutes
Fair
While you're here, how do I mark the solution? I don't have any context menu options 😅
Huh? That's weird? Can you screenshot your right click menu? There should be apps
And we have a bunch of apps in fact
Don't even have the Apps selection 😂
Outdated client then... Are you using a custom client? Not betterdiscord or similar but a full custom client.
No, just plain Discord
Bizarre
Well which message exactly did you want to mark? I can do it for you
Your 1st answer 🙂