refactor ext updater: adjust according to core.

This commit is contained in:
thedragonsinn
2024-09-26 15:18:20 +05:30
parent 3021b03296
commit 5b4f1f794f

View File

@@ -1,14 +1,13 @@
from ub_core.default_plugins.restart import restart
from ub_core.utils import run_shell_cmd
from app import BOT, Message, bot
@bot.add_cmd(cmd="supdate", allow_sudo=False)
async def social_dl_update(bot: BOT, message: Message):
@bot.add_cmd(cmd="extupdate", allow_sudo=False)
async def extra_modules_updater(bot: BOT, message: Message):
output = await run_shell_cmd(
cmd="cd app/modules && git pull", timeout=10, ret_val="0"
)
update_notif = await message.reply(output)
await message.reply(output)
if output.strip() != "Already up to date.":
await restart(bot, message, update_notif)
bot.raise_sigint()