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.
#Using GitHub to clone files on `on_ready`
1 messages · Page 1 of 1 (latest)
not sure how this is related to pycord, but I think making a github bot/app is the way to go: https://docs.github.com/en/apps
where it says to create an app, it doesnt show the create app button
i swear some company documentation actually suck
again, I've never done this before, so I don't know
Do you initialise a local repo for each bot? If yes then you can just do os.system('git pull origin')
No it’s only 1 repo
And I’d like it to clone specific files, not all
Ah hmm
I meant local repo
Like do you have local clone of a GitHub repo
Yes I would have it
You could move those specific files into a separate repo
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
That idk lol
Nvm I got myself confused
I would have put those sepcific files in a separate repo
Is this not possible?
It is
But HOW do I clone specific files from that repo
Instead of every file
If possible
Is the list not same everytime?
YK what
This might be better
https://unix.stackexchange.com/a/387912
Unix & Linux Stack Exchange
For example, there is a file here that I want to download via CLI: https://raw.githubusercontent.com/raspberrypi/linux/rpi-4.1.y/arch/arm/configs/bcmrpi_defconfig
How to I download the actual file...
Actually how can I get a GitHub file’s content?
original link: https://github.com/Pycord-Development/pycord/blob/master/README.rst
actual file contents: https://raw.githubusercontent.com/Pycord-Development/pycord/master/README.rst
GitHub
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/README.rst at master · Pycord-Development/pycord
Pretty sure that link is exactly about that
How to wget/curl the raw contents of a GitHub file
How would I do that in the on_ready event tho
That’s just an issue someone had
You dont
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
If you import those files
I was wanting to have it compare versions with bot.version and version.txt
Actually probably not on ready
Hmm how will you have bot.version tho?
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