-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot.py
45 lines (38 loc) · 1.47 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
import sys
from pyrogram import Client
import config
from ..logging import LOGGER
class AnonXBot(Client):
def __init__(self):
LOGGER(__name__).info(f"Starting Bot...")
super().__init__(
"AnonXMusic",
api_id=config.API_ID,
api_hash=config.API_HASH,
bot_token=config.BOT_TOKEN,
)
async def start(self):
await super().start()
get_me = await self.get_me()
self.username = get_me.username
self.id = get_me.id
if get_me.last_name:
self.name = get_me.first_name + " " + get_me.last_name
else:
self.name = get_me.first_name
a = await self.get_chat_member(config.LOG_GROUP_ID, self.id)
if a.status != "administrator":
LOGGER(__name__).error(
"Please promote Bot as Admin in Logger Group"
)
sys.exit()
LOGGER(__name__).info(f"MusicBot Started as {self.name}")
try:
await self.send_message(
config.LOG_GROUP_ID, f"**» تم تشغيل بوتك على DAEK • 𝙎𝙊𝙐𝙍𝘾𝙀 بنجاح :**\n\n✨ ɪᴅ : `{self.id}`\n❄ ɴᴀᴍᴇ : {self.name}\n💫 ᴜsᴇʀɴᴀᴍᴇ : @{self.username}"
)
except:
LOGGER(__name__).error(
"Bot has failed to access the log Group. Make sure that you have added your bot to your log channel and promoted as admin!"
)
sys.exit()