upd_restart.py
· 341 B · Python
Raw
import subprocess
import sys
@router.message(F.text == "/reboot")
async def command_handler(msg: types.Message, *args, **kwargs):
if msg.from_user.id in [1234567890, 123123123]:
subprocess.run(["git", "pull"], check=True, stdout=subprocess.PIPE).stdout
python = sys.executable
os.execl(python, python, *sys.argv)
| 1 | import subprocess |
| 2 | import sys |
| 3 | |
| 4 | @router.message(F.text == "/reboot") |
| 5 | async def command_handler(msg: types.Message, *args, **kwargs): |
| 6 | if msg.from_user.id in [1234567890, 123123123]: |
| 7 | subprocess.run(["git", "pull"], check=True, stdout=subprocess.PIPE).stdout |
| 8 | python = sys.executable |
| 9 | os.execl(python, python, *sys.argv) |