Skip to content
Sign upLog in
How can i "save" wat happened when i use the command
Profile icon
Pokedric

Lets take "Dank memer" for example. I want the bot to remember what i have and what i did. Example: What the bot said, and for example i got 1 fish when i used the command, I want the bot to know that i have 1 fish when i use the command again.
(If you don't understand i dont blame you)

You are viewing a single comment. View All
Profile icon
OldWizard209

You will need to use replit's database. The databse works with key-value pairs. But because your user will have more than one thing in his inventory, you can pass in a list or dicitonary.:

from replit import db username = "BigBoiii" # Example username... db[username] = [fish, money, boars, deers, skunks, rods, rifles.] # "Possible" Examples of Dank Memer Items. # To access: fish = int(db[username][0]) # Change value of fish: fish = 1 print(f"You have {fish} fish")

So no matter how many times the bot is restarted, replit's database will save the data.

Profile icon
Pokedric

@OldWizard209
Thanks so much!

Profile icon
OldWizard209

np, would mind marking the answer as correct then?

@Pokedric

Profile icon
Pokedric

@OldWizard209
yes, done