-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbot.py
32 lines (26 loc) · 922 Bytes
/
bot.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
from pyrogram import Client, __version__, idle
from pyrogram.raw.all import layer
from config import Config
class Bot(Client):
def __init__(self):
super().__init__(
session_name=Config.SESSION_NAME,
api_id=Config.API_ID,
api_hash=Config.API_HASH,
bot_token=Config.BOT_TOKEN,
workers=Config.WORKERS,
plugins=dict(
root="plugins"
)
)
async def start(self):
await super().start()
me = await self.get_me()
print(f"{me.first_name} with for Pyrogram v{__version__} (Layer {layer}) started on @{me.username}.")
async def stop(self, *args):
me = await self.get_me()
await super().stop()
print(f"@{me.username} stopped. Bye.")
asnyc def idle(self):
print(f"Idling {me.username}")
await idle()