How can I update variable data in an embed message?

I have an embedded message in which I use other variables from config.json for outputting the right data at the right time. But the problem is that when I change the config.json and output the embed message again - it is not updated. I have to restart the bot, and that's not what I need.
No description
9 Replies
d.js toolkit
d.js toolkit5w ago
- 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 staff
treble/luna
treble/luna5w ago
you have to reinitialize your config variable, not djs related a config.json isnt meant to be dynamic you should use databases for that
RLodka
RLodkaOP5w ago
How will the database help solve the problem? My config.json can be said to be a local database that contains country data that will change as the bot is used. All I need is that when I output information about the country, the current information is displayed, which is recorded in config.json. The usual query works for me, but the embed message is not updated.
No description
treble/luna
treble/luna5w ago
because a database doesnt require you to initialize your whole config variable
RLodka
RLodkaOP5w ago
No description
treble/luna
treble/luna5w ago
and i also think its cached so you would have to reload it
RLodka
RLodkaOP5w ago
I'll try to make a database one of these days. About caching - what do you mean?
treble/luna
treble/luna5w ago
when you require() a file, it'll be cached, so you would have to delete the require cache to import it again
RLodka
RLodkaOP5w ago
Got it, thanks for the help! @treble/luna I tried deleting the cache as you said. The data is now updated. Thank you again for solving the problem!

Did you find this page helpful?