#Using GitHub to clone files on `on_ready`

1 messages · Page 1 of 1 (latest)

subtle prairie
#

The reason I want to do this is because I have ton of paid for client bots (18), and some of them use the same code. I am the type of person to always want to update the code to make it better. So, that means I am updating the code a lot. When I update it for one, I have to update it for all of them. Therefore, I'd like to use Github's API to clone specific files from my private repo during the on_ready event. How can I do this? I'm not familiar with Github's API.

stable river
stable river
#

again, I've never done this before, so I don't know

young raft
subtle prairie
#

And I’d like it to clone specific files, not all

young raft
#

Like do you have local clone of a GitHub repo

subtle prairie
#

Yes I would have it

young raft
#

You could move those specific files into a separate repo

subtle prairie
#

Wait no

#

Since the files are on my hosting provider, and the GitHub files aren’t on there

#

I want to pull the files from GitHub’s api

#

Or clone specific files from a GitHub repo

young raft
subtle prairie
#

Nvm I got myself confused

young raft
subtle prairie
#

I want it to clone files on startup

#

From a GitHub repo

young raft
subtle prairie
#

But HOW do I clone specific files from that repo

#

Instead of every file

#

If possible

young raft
#

YK what

subtle prairie
stable river
young raft
#

How to wget/curl the raw contents of a GitHub file

subtle prairie
#

That’s just an issue someone had

young raft
#

Do it using a shell script

#

And at the end of it, start the python file

#

Or, make a python file that does the same using os.system at the beginning, and then runs the bot

#

Doing it on ready might be a bad idea

young raft
subtle prairie
#

I was wanting to have it compare versions with bot.version and version.txt

#

Actually probably not on ready

young raft
#

What you could do is, store version.txt locally and on GitHub. It should only have smth like 1.3 and nothing else

#

Get the contents of version.txt on GitHub (using requests/aiohttp)

#

Compare it with the local file

#

If different, get and store contents of all the other files into the one locally available

#

Hmm you actually don't even need os.system