forked from gooberinc/goober
improved updater
This commit is contained in:
parent
c0030b77b0
commit
d6c6605e2a
2 changed files with 9 additions and 5 deletions
|
@ -184,7 +184,7 @@ class BaseCommands(commands.Cog):
|
||||||
async def force_update(self, ctx: commands.Context):
|
async def force_update(self, ctx: commands.Context):
|
||||||
await ctx.send("Forcefully updating...")
|
await ctx.send("Forcefully updating...")
|
||||||
subprocess.run([sys.executable, sys.executable, "updater.py"])
|
subprocess.run([sys.executable, sys.executable, "updater.py"])
|
||||||
sys.exit()
|
exit()
|
||||||
|
|
||||||
@requires_admin()
|
@requires_admin()
|
||||||
@commands.command()
|
@commands.command()
|
||||||
|
|
12
updater.py
12
updater.py
|
@ -2,15 +2,19 @@ import subprocess
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger("goober")
|
||||||
|
|
||||||
def force_update() -> None:
|
def force_update() -> None:
|
||||||
print("Forcefully updating...")
|
logger.info("Forcefully updating...")
|
||||||
stash = subprocess.run(["git", "stash"], capture_output=True)
|
stash = subprocess.run(["git", "stash"], capture_output=True)
|
||||||
print(stash)
|
logger.info(stash)
|
||||||
pull = subprocess.run(["git", "pull", "origin", "main"], check=True, capture_output=True)
|
pull = subprocess.run(["git", "pull", "origin", "main"], check=True, capture_output=True)
|
||||||
print(pull)
|
logger.info(pull)
|
||||||
|
|
||||||
print("Starting bot")
|
logger.info("Starting bot")
|
||||||
os.execv(sys.executable, [sys.executable, "bot.py"])
|
os.execv(sys.executable, [sys.executable, "bot.py"])
|
||||||
|
|
||||||
force_update()
|
force_update()
|
Loading…
Add table
Add a link
Reference in a new issue