Doubt about how data is tracked in embeds/buttons
I have a questiong regarding embeds/buttons, ill give you an example here:
Lets pretend that im making a suggestion bot, now people is gonna use a command to generate an embed with 2 buttons, either accept or deny, how does the bot store what embed links to what user etc, does this structure include databases or am I too noob.
Like users are gonna create an infinite number of suggestions and the but must know what suggestion links to what user. And im not talking about displaying user information in the embed, im talking about after using the buttons get back information about who made the suggestion to interact with it.
Thanks and sorry for being kinda dumb.
10 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPyou need to store the id of the message and map it to the suggestion / whatever content you display
then, when receiving the button interaction, compare <ButtonInteraction>.message.id
Alternatively, you can use the latter and parse out the content from <Message>.embeds
Does that mean i need to involve some mind of database? Like json or whatever
yes
json isnt a database btw
Wasnt there a way to store data that way? For small stuff
You can use JSON files as a database, but it not meant to be used so
I mean a database seems overcomplicated, storing data in every suggestion...,
Is it easy to setup?
Depends on the database and driver you choose
Node.js has
node:sqlite
built-inI think in gonna use mongodb, so basically store a suggestion with the message id, the user, and bla bla and then just listen to the interaction and look for that specific suggestion right?, the interaction with the button will provide me the message id that i need to look for in the db etc etc