#Is it possible to add hidden data to a message?
8 messages · Page 1 of 1 (latest)
• 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.
Messing with internal objects isn't always a good ideia
If you want to pass stuff between function, you can pass as function params
Yeah, but how to pass it across interactions.
Lets say I have a select field with Banana, Apple, Kiwi as options and selectFruit as customId.
Now when I receive the interaction, I get the values (selected fruits) and the customId, but what if I also wanted to pass basket3 as variable to the interaction handler so that I know which basket to update.
I could modify the values of the select to Banana|basket3, Apple|basket3, etc. and then parse the values. But that seems a bit like a hacky workaround. Is there a cleaner solution?
Just pass a parameter to your handler: handler(interaction, 'basket3')
But yeah this would work too
Hm but the information (e.g. basket3) is dynamic and set at the time the select menu is created, so I can't hardcode it into the handler. For example select basket -> select fruits in basket -> update database with selection
I would need an option to pass along arbitrary data (or a string is fine). I didn't see any method for that in the docs so I assume I have to just abuse the value property.