all repos — gif-escarbot @ 2887fe39566627082d2e98fd2142c668c35b8094

Earthbound Café's custom delivery bot with other cool utilities built-in.

Config.py (view raw)

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