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:
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
Jump to solution
18 Replies
Solution
Favna
Favna•15mo ago
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
Marino
Marino•15mo ago
Suppose I could just use a Collection? Actually, yeah, that'll work, thanks
Favna
Favna•15mo ago
alternatively you can use a collection btw
Marino
Marino•15mo ago
Is there a max length to the custom IDs?
Favna
Favna•15mo ago
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
Marino
Marino•15mo ago
Yeah I'll do it like that Thank you 🙂
Favna
Favna•15mo ago
Just be wary that such a collection is in memory. If you want some external cache then Redis is your friend
Marino
Marino•15mo ago
It's a very temporary process, it'll only get stored in there for a maximum of maybe 3-5 minutes
Favna
Favna•15mo ago
Fair
Marino
Marino•15mo ago
While you're here, how do I mark the solution? I don't have any context menu options 😅
Favna
Favna•15mo ago
Huh? That's weird? Can you screenshot your right click menu? There should be apps
Favna
Favna•15mo ago
And we have a bunch of apps in fact
Marino
Marino•15mo ago
Don't even have the Apps selection 😂
Favna
Favna•15mo ago
Outdated client then... Are you using a custom client? Not betterdiscord or similar but a full custom client.
Marino
Marino•15mo ago
No, just plain Discord
Favna
Favna•15mo ago
Bizarre Well which message exactly did you want to mark? I can do it for you
Marino
Marino•15mo ago
Your 1st answer 🙂