-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbot.py
40 lines (34 loc) · 1.03 KB
/
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
35
36
37
38
39
40
# Copyright 2024 Qewertyy, MIT License
import uvloop
uvloop.install()
import datetime,logging, sys
from pyrogram import Client
from config import Config
import httpx
# Get logging configurations
logging.basicConfig(
format="%(asctime)s - [BOT] - %(levelname)s - %(message)s",
handlers=[logging.FileHandler("logs.txt"), logging.StreamHandler()],
level=logging.INFO,
)
logging.getLogger("pyrogram").setLevel(logging.WARNING)
logging.getLogger("httpx").setLevel(logging.WARNING)
LOGGER = logging.getLogger(__name__)
StartTime = datetime.datetime.now()
class Bot(Client):
def __init__(self):
super().__init__(
"AntiNSFWRobot",
api_id=Config.API_ID,
api_hash=Config.API_HASH,
bot_token=Config.BOT_TOKEN,
plugins=dict(root="modules"),
)
async def start(self):
await super().start()
LOGGER.info("Bot Started")
async def stop(self):
await super().stop()
LOGGER.info("Stopped Services")
if __name__ == "__main__":
Bot().run()