Config.py (view raw)
1import logging
2from os import getenv
3from dotenv import load_dotenv
4load_dotenv()
5
6logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
7logging.getLogger("httpx").setLevel(logging.WARNING)
8
9logger = logging.getLogger(__name__)
10INLINE_SEP = 3 * "#"
11
12def config_error():
13 logger.error("Please create and fill the .env file.")
14 exit(1)
15
16try:
17 TOKEN = str(getenv("token"))
18 GROUP_ID = int(getenv("group_id"))
19 CHANNEL_ID = int(getenv("channel_id"))
20 ADMIN_ID = int(getenv("admin_id"))
21except TypeError:
22 config_error()
23
24if '' in [TOKEN, GROUP_ID, CHANNEL_ID, ADMIN_ID]:
25 config_error()