MysteryPancake / Discord-Reposter

Bot for reposting Discord messages (work in progress)
MIT License
92 stars 121 forks source link

hey i had another question. whenever i edit the code of the bot and push it again to the online cloud server, it resets and all the reposts stop. so i have to type the reposting commands again. is their a way to fix this? #41

Open saatvikn opened 4 years ago

MysteryPancake commented 4 years ago

Persistent storage is a bit tricky on cloud servers for Discord bots in general. What server are you using at the moment?

At the moment this bot uses a simple JSON file to store some configuration settings (although not currently enough to resume reposting), which works OK for local servers, but not very well for online ones. For other bots with persistent storage I had to set up a MongoDB database to store data persistently, but it can be a bit messy to set up.

Depending on the server, if there is a way to keep the previous JSON file it might be possible without setting up a database.

saatvikn commented 4 years ago

i am using heroku to host the bot.

MysteryPancake commented 4 years ago

I have the same issue with Heroku. Each time a Heroku worker is restarted, it wipes everything including the JSON file. With most bots this doesn't cause any issues but any bot with persistent storage will have this problem. The only way to avoid this would be to set up a separate a database to store the JSON file, but I don't have any code to do this currently.

saatvikn commented 4 years ago

ok thank you tho. if you find any solution then keep me posted 👍