Ask coding questions

← Back to all posts
Saving My Variables?
Speedrace (3)

How do I keep each of my variables the same even when I refresh the bot to edit the code? It keeps resetting

Commentshotnewtop
Vandesm14 (542)

You could also use a file DB

Speedrace (3)

@Vandesm14 What is that and how do I use it?

Vandesm14 (542)

@Speedrace If you know how to read and write files, you can save a JSON object to a variable, save it to a file, and pull the JSON from the file on program start.
PS: If you are using private data, you can use a .env file instead, since repl.it hides .env

Please mark this as answered if I helped your problem 👍

ThatSmart (43)

I would look into using an external database.