forked from Akarata/Jichu_Userbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
94 lines (81 loc) · 2.46 KB
/
__init__.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
87
88
89
90
91
92
93
94
# sourcery skip: de-morgan
import os
import sys
import time
from distutils.util import strtobool as sb
from logging import DEBUG, INFO, basicConfig, getLogger
import heroku3
from dotenv import load_dotenv
from requests import get
from telethon import TelegramClient
from telethon.sessions import StringSession
from .Config import Config
StartTime = time.time()
catversion = "2.0"
if Config.STRING_SESSION:
session_name = str(Config.STRING_SESSION)
if session_name.endswith("="):
bot = TelegramClient(
StringSession(session_name), Config.APP_ID, Config.API_HASH
)
else:
bot = TelegramClient(
"TG_BOT_TOKEN", api_id=Config.APP_ID, api_hash=Config.API_HASH
).start(bot_token=Config.STRING_SESSION)
else:
session_name = "startup"
bot = TelegramClient(session_name, Config.APP_ID, Config.API_HASH)
# PaperPlaneExtended Support Configs
ENV = os.environ.get("ENV", False)
CAT_ID = ["1035034432", "551290198"]
# Bot Logs setup:
if bool(ENV):
CONSOLE_LOGGER_VERBOSE = sb(os.environ.get("CONSOLE_LOGGER_VERBOSE", "False"))
if CONSOLE_LOGGER_VERBOSE:
basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
level=DEBUG,
)
else:
basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=INFO
)
LOGS = getLogger(__name__)
# Check if the config was edited by using the already used Configiable.
# Basically, its the 'virginity check' for the config file ;)
CONFIG_CHECK = os.environ.get(
"___________PLOX_______REMOVE_____THIS_____LINE__________", None
)
if CONFIG_CHECK:
LOGS.info(
"Please remove the line mentioned in the first hashtag from the config.env file"
)
quit(1)
try:
if Config.HEROKU_API_KEY is not None or Config.HEROKU_APP_NAME is not None:
HEROKU_APP = heroku3.from_key(Config.HEROKU_API_KEY).apps()[
Config.HEROKU_APP_NAME
]
else:
HEROKU_APP = None
except:
HEROKU_APP = None
else:
# Put your ppe Configs here if you are using local hosting
PLACEHOLDER = None
# Global Configiables
COUNT_MSG = 0
USERS = {}
COUNT_PM = {}
LASTMSG = {}
CMD_HELP = {}
ISAFK = False
AFKREASON = None
CMD_LIST = {}
SUDO_LIST = {}
# for later purposes
INT_PLUG = ""
LOAD_PLUG = {}
# showing imports error
from .helpers import *
from .helpers import functions as catdef