diff --git a/program/updater.py b/program/updater.py index 6e1067c..afd5610 100644 --- a/program/updater.py +++ b/program/updater.py @@ -33,6 +33,20 @@ from driver.decorators import bot_creator from driver.database.dbqueue import get_active_chats, remove_active_chat +async def install_requirements(cmd: str) -> Tuple[str, str, int, int]: + args = shlex.split(cmd) + process = await asyncio.create_subprocess_exec( + *args, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE + ) + stdout, stderr = await process.communicate() + return ( + stdout.decode("utf-8", "replace").strip(), + stderr.decode("utf-8", "replace").strip(), + process.returncode, + process.pid, + ) + + @Client.on_message(command(["update", f"update@{BOT_USERNAME}"]) & ~filters.edited) @bot_creator async def update_bot(_, message: Message):