-
Notifications
You must be signed in to change notification settings - Fork 75
/
bot.py
34 lines (27 loc) · 892 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
33
34
import os
from heroku3 import from_key
from pyrogram import Client
from pyromod import listen
class Config:
API_ID = int(os.environ.get("API_ID", 0))
API_HASH = os.environ.get("API_HASH", None)
BOT_TOKEN = os.environ.get("BOT_TOKEN", None)
APP_NAME = os.environ.get("APP_NAME", None)
API_KEY = os.environ.get("API_KEY", None)
HU_APP = from_key(API_KEY).apps()[APP_NAME]
class Bot(Client):
def __init__(self):
kwargs = {
'api_id': Config.API_ID,
'api_hash': Config.API_HASH,
'name': ':memory:',
'bot_token': Config.BOT_TOKEN
}
super().__init__(**kwargs)
async def start(self):
await super().start()
async def stop(self):
await super().stop()
async def sleep(self, msg):
await msg.reply("`Sleeping for (10) Seconds.`")
Config.HU_APP.restart()