Problem with fs and json file when saving data (Discord Bot)

java

#1

Hello, im cuerrently working in a discord bot, and im trying to save some data in this case for Leves an XP system, but when i try with fs y still have the file blank but the code detects some info inside the file (xp.json), because if i do !level thats a command to know your level it told me the level and the ammount of xp but my file is clearly empty.

And using vsCode in Windows 10, i got the same setup as in glitch.com but the file updates when a new value is detected by the code.

i hope im been clear,
thanks Renzo


#2

Hey Renzo, I think what you’re seeing here (if I’m interpreting you correctly) is that files that are altered on the backend (that is to say not in the editor - so either by your code or by using something like vim in your project’s console) don’t automatically get synced with the editor, so Glitch sees the right content if you use it in your code, but you won’t see it reflected in the editor unless you run the refresh command in your project’s console.

Be aware before you do so, though, that that also restarts your project, so if that’s something you want to avoid you should keep that in mind…

Happy Glitching!


#3

Ohh I see, thanks for the answer I think I’m gonna use a npm quick.db instead.
I hope I don’t get the same.