-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathbot.py
86 lines (69 loc) · 2.07 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Don't Edit
import asyncio
import datetime
import logging
import logging.config
import sys
from pyrogram import *
from pyrogram.errors.exceptions.not_acceptable_406 import *
from config import *
from database import *
from database.users import *
from helpers import *
from pyshorteners import *
logging.config.fileConfig('logging.conf')
logging.getLogger().setLevel(logging.INFO)
import os
import pyrogram
logging.getLogger("pyrogram").setLevel(logging.WARNING)
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) Shrimadhav U K
if __name__ == "__main__" :
plugins = dict(
root="plugins"
)
dkbotz = Client(
"Mdisk-Pro",
bot_token=BOT_TOKEN,
api_id=API_ID,
api_hash=API_HASH,
plugins=plugins
)
async def start(self):
me = await self.get_me()
self.owner = await self.get_users(int(OWNER_ID))
self.username = f'@{me.username}'
temp.BOT_USERNAME = me.username
temp.FIRST_NAME = me.first_name
if not await db.get_bot_stats():
await db.create_stats()
banned_users = await filter_users({"banned": True})
async for user in banned_users:
temp.BANNED_USERS.append(user["user_id"])
logging.info(LOG_STR)
await broadcast_admins(self, '** Bot started successfully **\n\nBot By @DKBOTZ')
logging.info('Bot started')
dkbotz.run()
# Removed Upper All Codes Because This is Not Required Now.
#SESSION = "DKBOTZ"
#class Bot(Client):
#def __init__(self):
#super().__init__(
# name=SESSION,
#api_id=API_ID,
# api_hash=API_HASH,
# bot_token=BOT_TOKEN,
#workers=50,
# plugins={"root": "plugins"},
#sleep_threshold=5,
#)
async def stop(self, *args):
await super().stop()
logging.info("Bot stopped. Bye.")
#dkbotz = Bot()
#dkbotz.run()