Recently, I've been making a fun server specific discord bot for me and my friends. (Using discord.py). Because I need to turn off my computer at night, I cannot run my bot continuously on my PC. I decided to make a GitHub repository and deploy it to a service called Heroku, that way it is guaranteed to run without my supervision.
That's where my problems start. I have a point system that dumps the user's ID along with the points awarded to them in a file I named data.txt. The file has not been updating since then. I suspect it is because you must commit to the file in order to alter it in anyway.
What I have tried:
I went down a massive rabbit hole, learning about committing files via python. By importing py.discord, you can alter your code from there. HOWEVER!
No articles ever mention editing a file. Rather, they commit new files or completely replace them! Maybe I can have the bot copy and paste the current data and add the new user IDs, and then add them together. But I'm unaware if that's possible. Here's a command I assigned to "_save()":
with open('data.txt', 'w+') as f:
Anyone know how I can implement it? Documents on py.github: Introduction — PyGithub 1.55 documentation