Answer the question
In order to leave comments, you need to log in
How to force require to write a variable again?
There's a problem with the variable cache where the code just doesn't read it again until it's reloaded.
I need that every time (conditionally, when interacting with the button, it accesses the json file and sees if there is data there). And he writes them down for the first time when they are empty, then he writes down when the information appeared there, but when the information is removed from the file, he stops overwriting it, and just remembers what was.
ps This is for ds bot, and the command is used very rarely, no need to write about the load.
Answer the question
In order to leave comments, you need to log in
You don't have to want it. There are corresponding methods for reading files https://nodejs.org/api/fs.html
In particular readFile/readFileSync
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question