Is there a better way of saving Discord bot chat history than this?

I’m making a Discord bot and I wanted to add a way to log chat history so that if the repl disconnects on me, I can just hit run to start it up again and continue like nothing happened without resetting its “chat history”.

I’m using Python and I was thinking of reading and writing to a txt file, but I’m wondering if there’s a better way that doesn’t involve creating a publicly visible txt file with all the chat logs?

Hey @rayzerxd!

You could use a database. Replit has a built-in one:

from replit import db
db["key"] = "value"

You could also get the Replit Core plan ($20/mo) and make your repl private.


Thank you :slight_smile: Will check that out

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.