#it will get reseted no matter what
1 messages · Page 1 of 1 (latest)
t
What makes json bad? i keep the json updated every hour and catch any crash to write the cache to the file regardless
if your json size is small then that would be okay
json can easily get corrupted if there are way too many concurrent read/write
that's probably fine
and about your original q, you cant store to a js array, as it'll be reseted upon restart
hm okay
cus i know fs.writefilesync for json works
but wasnt sure how to use a js file in that
how can the js file reset if i overwrite it?
why would you want to use js to store data? you will have to parse the file a bit to access the actual data (get rid of js syntax)
when readFileSync returns string for both json and js anyway
To create slash command files
i use a js structured file, then read it using```js
const guildCommands = require('./commands/resourcecmds.js').commands
mainguild.commands.set(guildCommands)```
and i was going to use it to store messages the bot needs to put into cache upon reboot, but using json will work as well
just thought i might as well use js if i am using it for slash commands anyways
thanks for your explanations, i might just have to use Sqlite but im not as confident in that as in my json capabilities (as that is basic asf)
well
using this is, probably, fine
just remember to remove the require cache everytime you update that file
I dont think json files would allow for this type of clusterfuck structure, never tested it so will do that avtually
why wouldnt it? as long as you only use null, boolean, string, array, some others thing i dont remember + your json file is small and not require frequent read/write, it's pretty much fine
(your structure above is fine to save into a json)
i had issues before, i thought the amount of arrays in objects with arrays cascading wasnt supported but i just flubbed the quotation marks, need to all be double quotes, including the object names