diff --git a/src/__main__.py b/src/__main__.py index 0ddbac2..c385cbe 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -16,18 +16,17 @@ def validate(): exit(2) if config.ADMIN_ID == 0: - print("WARNING: You didn't configured an ADMIN_ID, so you won't be able to use admin commands!") - - if config.FEEDBACK_CHAT_ID == 0: - print("ERROR: Please configure FEEDBACK_CHAT_ID") + print("ERROR: Please configure ADMIN_ID") exit(2) - if config.LOGGER_CHAT_ID == 0: - print("ERROR: Please configure LOGGER_CHAT_ID") - exit(2) + if config.FEEDBACK_CHAT_ID == config.ADMIN_ID: + print("WARNING: FEEDBACK_CHAT_ID and ADMIN_ID are same") + + if config.LOGGER_CHAT_ID == config.ADMIN_ID: + print("WARNING: LOGGER_CHAT_ID and ADMIN_ID are same") - if config.ANNOUNCEMENT_CHECK_INTERVAL == 0: - print("ERROR: Please configure ANNOUNCEMENT_CHECK_INTERVAL") + if config.ANNOUNCEMENT_CHECK_INTERVAL <= 0: + print("ERROR: Please configure ANNOUNCEMENT_CHECK_INTERVAL greater than 0") exit(2) if config.WEBHOOK_CONNECTED: diff --git a/src/config.py b/src/config.py index b17f3eb..2243801 100644 --- a/src/config.py +++ b/src/config.py @@ -12,29 +12,29 @@ DB_STRING: str = config["DB_STRING"] DB_NAME: str = config["DB_NAME"] -# Feedback Chat ID -FEEDBACK_CHAT_ID: int = config["FEEDBACK_CHAT_ID"] - # Admin Chat ID ADMIN_ID: int = config["ADMIN_ID"] +# Feedback Chat ID +FEEDBACK_CHAT_ID: int = config.get("FEEDBACK_CHAT_ID", ADMIN_ID) + # Logger Chat ID -LOGGER_CHAT_ID: int = config["LOGGER_CHAT_ID"] +LOGGER_CHAT_ID: int = config.get("LOGGER_CHAT_ID", ADMIN_ID) # Default Department List -DEFAULT_DEPS: list[str] = config["DEFAULT_DEPS"] +DEFAULT_DEPS: list[str] = config.get("DEFAULT_DEPS", []) # Time Configurations for the Announcement Checking Task (in seconds) -ANNOUNCEMENT_CHECK_INTERVAL: int = config["ANNOUNCEMENT_CHECK_INTERVAL"] -ANNOUNCEMENT_CHECK_FIRST: int = config["ANNOUNCEMENT_CHECK_FIRST"] +ANNOUNCEMENT_CHECK_INTERVAL: int = config.get("ANNOUNCEMENT_CHECK_INTERVAL", 1800) +ANNOUNCEMENT_CHECK_FIRST: int = config.get("ANNOUNCEMENT_CHECK_FIRST", 5) # Polling or Webhook? -WEBHOOK_CONNECTED: bool = config["WEBHOOK_CONNECTED"] -PORT: str = config["PORT"] -WEBHOOK_URL: str = config["WEBHOOK_URL"] +WEBHOOK_CONNECTED: bool = config.get("WEBHOOK_CONNECTED", False) +PORT: str = config.get("PORT", "31415") +WEBHOOK_URL: str = config.get("WEBHOOK_URL", "") # Conversation timeout values -FEEDBACK_TIMEOUT: int = config["FEEDBACK_TIMEOUT"] -ADMIN_ANNOUNCEMENT_TIMEOUT: int = config["ADMIN_ANNOUNCEMENT_TIMEOUT"] -ADD_TIMEOUT: int = config["ADD_TIMEOUT"] -REMOVE_TIMEOUT: int = config["REMOVE_TIMEOUT"] +FEEDBACK_TIMEOUT: int = config.get("FEEDBACK_TIMEOUT", 300) +ADMIN_ANNOUNCEMENT_TIMEOUT: int = config.get("ADMIN_ANNOUNCEMENT_TIMEOUT", 300) +ADD_TIMEOUT: int = config.get("ADD_TIMEOUT", 60) +REMOVE_TIMEOUT: int = config.get("REMOVE_TIMEOUT", 60)