PagerMaid-Pyro/pagermaid/modules/update.py

20 lines
732 B
Python
Raw Normal View History

2022-06-20 13:55:14 +00:00
from sys import executable, exit
2022-05-23 12:40:30 +00:00
from pagermaid.listener import listener
from pagermaid.utils import lang, execute, Message, alias_command
@listener(is_plugin=False, outgoing=True, command=alias_command("update"),
need_admin=True,
description=lang('update_des'),
parameters="<true/debug>")
2022-06-20 13:55:14 +00:00
async def update(message: Message):
2022-05-23 12:40:30 +00:00
await execute('git fetch --all')
if len(message.parameter) > 0:
await execute('git reset --hard origin/master')
await execute('git pull --all')
2022-05-27 15:09:24 +00:00
await execute(f"{executable} -m pip install --upgrade -r requirements.txt")
2022-05-23 12:40:30 +00:00
await execute(f"{executable} -m pip install -r requirements.txt")
await message.edit(lang('update_success'))
2022-06-08 03:18:21 +00:00
exit(0)