forked from TgCatUB/catuserbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
70 lines (60 loc) · 1.67 KB
/
__init__.py
File metadata and controls
70 lines (60 loc) · 1.67 KB
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
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.10.1"
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)
CAT_ID = ["1035034432", "551290198"]
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__)
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
# 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 = {}