From d6c6605e2a7473cdc544c61c67c3f28879684678 Mon Sep 17 00:00:00 2001 From: ctih1 Date: Sat, 26 Jul 2025 22:24:17 +0300 Subject: [PATCH] improved updater --- assets/cogs/internal/base_commands.py | 2 +- updater.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/assets/cogs/internal/base_commands.py b/assets/cogs/internal/base_commands.py index 4792c5a..47c2f8b 100644 --- a/assets/cogs/internal/base_commands.py +++ b/assets/cogs/internal/base_commands.py @@ -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() diff --git a/updater.py b/updater.py index 29b002d..62295e0 100644 --- a/updater.py +++ b/updater.py @@ -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() \ No newline at end of file