forked from callsmusic/vcpb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
37 lines (30 loc) · 926 Bytes
/
bot.py
File metadata and controls
37 lines (30 loc) · 926 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
from pyrogram import Client
from config import API_ID, API_HASH, TOKEN, LOG_GROUP
app = Client(
"my_account",
api_id=API_ID,
api_hash=API_HASH,
bot_token=TOKEN,
plugins={"root": "handlers", "exclude": None if LOG_GROUP else ["playlist"]}
)
if __name__ == "__main__":
import os
import sys
from threading import Thread
from pyrogram import idle, filters
from pyrogram.handlers import MessageHandler
import player
from config import SUDO_FILTER
from strings import _
def stop_and_restart():
app.stop()
os.system("git pull")
os.execl(sys.executable, sys.executable, *sys.argv)
@app.on_message(filters.command("r", "/") & SUDO_FILTER)
def restart(client, message):
message.reply_text(_("bot"))
Thread(
target=stop_and_restart
).start()
app.start()
idle()