forked from ritheshrkrm/Simple-Rename-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
33 lines (29 loc) · 893 Bytes
/
bot.py
File metadata and controls
33 lines (29 loc) · 893 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
from pyrogram import Client
from config import *
from route import web_server
from aiohttp import web
class Bot(Client):
def __init__(self):
super().__init__(
name="simple-renamer",
api_id=API_ID,
api_hash=API_HASH,
bot_token=BOT_TOKEN,
workers=100,
plugins={"root": "main"},
sleep_threshold=10,
)
async def start(self):
await super().start()
me = await self.get_me()
app = web.AppRunner(await web_server())
await app.setup()
bind_address = "0.0.0.0"
port = "8080"
await web.TCPSite(app, bind_address, port).start()
print(f"{me.first_name} | @{me.username} Started...⚡️")
async def stop(self, *args):
await super().stop()
print("Bot Restarting........")
bot = Bot()
bot.run()