-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path__main__.py
74 lines (62 loc) · 2.04 KB
/
__main__.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
import os
from pathlib import Path
from sys import argv
import telethon.utils
from telethon import TelegramClient
from userbot import bot
from userbot.utils import load_module, start_assistant
from var import Var
LOAD_USERBOT = os.environ.get("LOAD_USERBOT", True)
LOAD_ASSISTANT = os.environ.get("LOAD_ASSISTANT", True)
async def add_bot(bot_token):
await bot.start(bot_token)
bot.me = await bot.get_me()
bot.uid = telethon.utils.get_peer_id(bot.me)
if len(argv) not in (1, 3, 4):
bot.disconnect()
else:
bot.tgbot = None
if Var.TG_BOT_USER_NAME_BF_HER is not None:
print("Initiating Inline Bot")
# ForTheGreatrerGood of beautification
bot.tgbot = TelegramClient(
"TG_BOT_TOKEN", api_id=Var.APP_ID, api_hash=Var.API_HASH
).start(bot_token=Var.TG_BOT_TOKEN_BF_HER)
print("Initialised Sucessfully")
print("Starting Dark AI")
bot.loop.run_until_complete(add_bot(Var.TG_BOT_USER_NAME_BF_HER))
print("Startup Completed")
else:
bot.start()
import glob
if LOAD_USERBOT == True:
path = "userbot/plugins/*.py"
files = glob.glob(path)
for name in files:
with open(name) as f:
path1 = Path(f.name)
shortname = path1.stem
try:
load_module(shortname.replace(".py", ""))
except Exception as er:
print(er)
else:
print("Userbot is Not Loading As U Have Disabled")
if LOAD_ASSISTANT == True:
path = "userbot/plugins/assistant/*.py"
files = glob.glob(path)
for name in files:
with open(name) as f:
path1 = Path(f.name)
shortname = path1.stem
try:
start_assistant(shortname.replace(".py", ""))
except Exception as er:
print(er)
else:
print("Assitant is Not Loading As U Have Disabled")
print("DARK COBRA userbot AND YOUR ASSISTANT is Active Enjoy Join @DarkCobra_Support For Updates.")
if len(argv) not in (1, 3, 4):
bot.disconnect()
else:
bot.run_until_disconnected()