Last active 1767655611

admin revised this gist 1767655610. Go to revision

1 file changed, 1 insertion, 1 deletion

upd_restart.py

@@ -1,5 +1,5 @@
1 1 import subprocess
2 -
2 + import sys
3 3
4 4 @router.message(F.text == "/reboot")
5 5 async def command_handler(msg: types.Message, *args, **kwargs):

admin revised this gist 1767655580. Go to revision

1 file changed, 9 insertions

upd_restart.py(file created)

@@ -0,0 +1,9 @@
1 + import subprocess
2 +
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)
Newer Older