Discord Bot.js Heroku doesn't saves Chat XP system files

So i am making a discord bot everything was working fine i was using HEROKU as a Host, i have a Chat Xp system also but the problem is that Heroku reuploads files every 24 hrs so sadly The Rank Stored in file gets deleted every once in while which is a problem also this is my 1st post so sorry if there is any mistakes

Why don’t you use glitch instead then?

I don’t know glitch though
Can you provide links for tutorial or something?

seems like this is pretty enough.
the key point to remember is that glitch project doesnt run 24/7, and to do so people use https://uptimerobot.com/ to make your bot run 24/7. here’s how
1 Like

and yes even glitch gets frequent server refresh so your problem is going to be same. My bad, but you can make a JSON file to save all the data of user corresponding to their XP’s and then read the JSON file when ever any user ask for his XP/LEVEL, for level you just have to add extra line to calculate it with the provided XP.

EDIT: https://github.com/dragoonfirestormar/discordxpsystem Here is my coded Discord XP system which uses JSON file to save and extract data. It even calculates the RANKS according to the JSON data. You can implement it aswell. While using it, you wont be a risk of losing data.

I am doing that but Its in Github and whenever it refresh it gets blank cauz it reloads
EDIT:THANKS for the edit

Can you Just explain what happens in code as i also have written my own code so i can maybe mix it up
EDIT: just the getting and writing in files part

do NOT use a JSON to save data. Try using a database like MongoDB

1 Like

sorry this might be sort of cheap but is it free xD

That is very false, JSON files are very prone to corrupting

1 Like

500mb is free afaik

i just need 10mb so lol
can you give some quick start tutorials or what would you prefer to start

heres a simple tutorial of how to use mongod with a bot https://www.youtube.com/watch?v=2otiIRSmZII

note: use atlas for it (https://www.mongodb.com/cloud/atlas)

1 Like

Ok thanks i am marking this as solution just in case

Not an advertisement :grin:, but I have created an npm package called Jsoning which allows you to store data as JSON while preventing JSON-corruption. Documentation at https://jsoning.js.org.


Wow i was really looking for this only very thanks

1 Like

Can you add some sort of Tutorial other than that it’s really simple and also easy to use but a tutorial or something like that would make the process easier for new users like me

Sure, @MEGATANK58. I will add a tutorial section on the documentation that can help new users! And thanks for the feedback!