forked from Aluval/PixelPulseBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.py
More file actions
29 lines (22 loc) · 1015 Bytes
/
update.py
File metadata and controls
29 lines (22 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from subprocess import run as srun
from os import path as ospath
from sys import executable
from os import execl as osexecl
UPSTREAM_REPO = 'https://github.com/Aluval/PixelPulseBot'
UPSTREAM_BRANCH = 'SH24BOTS'
if UPSTREAM_REPO is not None:
if ospath.exists('.git'):
srun(["rm", "-rf", ".git"])
update = srun([f"git init -q \
&& git config --global user.email sunriseseditsoffical249@gmail.com \
&& git config --global user.name PixelPulseBot \
&& git add . \
&& git commit -sm update -q \
&& git remote add origin {UPSTREAM_REPO} \
&& git fetch origin -q \
&& git reset --hard origin/{UPSTREAM_BRANCH} -q"], shell=True)
if update.returncode == 0:
osexecl(executable, executable, "bot.py")
else:
print('Something went wrong while updating, check UPSTREAM_REPO if valid or not!')
osexecl(executable, executable, "bot.py")