improved updater

This commit is contained in:
ctih1 2025-07-26 22:24:17 +03:00
parent c0030b77b0
commit d6c6605e2a
2 changed files with 9 additions and 5 deletions

View file

@ -184,7 +184,7 @@ class BaseCommands(commands.Cog):
async def force_update(self, ctx: commands.Context):
await ctx.send("Forcefully updating...")
subprocess.run([sys.executable, sys.executable, "updater.py"])
sys.exit()
exit()
@requires_admin()
@commands.command()

View file

@ -2,15 +2,19 @@ import subprocess
import time
import sys
import os
import logging
logger = logging.getLogger("goober")
def force_update() -> None:
print("Forcefully updating...")
logger.info("Forcefully updating...")
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)
print(pull)
logger.info(pull)
print("Starting bot")
logger.info("Starting bot")
os.execv(sys.executable, [sys.executable, "bot.py"])
force_update()