forked from ArmTimDev/Vippy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVippy.py
More file actions
49 lines (38 loc) · 927 Bytes
/
Vippy.py
File metadata and controls
49 lines (38 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys
import os
from threading import Thread
from telegram.ext import Updater, CommandHandler, Filters
from handlers import all_handlers
updater = Updater("TOKEN")
for handler in all_handlers:
if len(handler) == 2:
updater.dispatcher.add_handler(
handler[0],
handler[1]
)
else:
updater.dispatcher.add_handler(
handler[0]
)
def stop_and_restart():
updater.stop()
os.system("git pull")
os.execl(sys.executable, sys.executable, *sys.argv)
def restart(update, contex):
update.message.reply_text("Restarting Vippy...")
Thread(
target=stop_and_restart
).start()
updater.dispatcher.add_handler(
CommandHandler(
"restart",
restart,
filters=Filters.user(
[
#Sudo Users
]
)
)
)
updater.start_polling()
updater.idle()