-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
38 lines (33 loc) · 830 Bytes
/
main.py
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
from pyrogram import Client, idle, filters
import os
from threading import Thread
import sys
from config import Config
from utils.vc import mp
import asyncio
CHAT=Config.CHAT
bot = Client(
"RadioPlayer",
Config.API_ID,
Config.API_HASH,
bot_token=Config.BOT_TOKEN,
plugins=dict(root="plugins")
)
async def main():
async with bot:
await mp.startupradio()
await asyncio.sleep(5)
await mp.startupradio()
def stop_and_restart():
bot.stop()
os.execl(sys.executable, sys.executable, *sys.argv)
bot.run(main())
bot.start()
@bot.on_message(filters.command("restart") & filters.user(Config.ADMINS))
def restart(client, message):
message.reply_text("**Restarting... Join @SDBOTz!**")
Thread(
target=stop_and_restart
).start()
idle()
bot.stop()