added portals, quest tracking, discord monitor etc etc
This commit is contained in:
parent
72de9b0f7f
commit
dffd295091
312 changed files with 4130 additions and 7 deletions
67
discord-rare-monitor/config.py
Normal file
67
discord-rare-monitor/config.py
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
"""
|
||||
Configuration module for Discord Rare Monitor Bot.
|
||||
Centralizes environment variable handling and configuration constants.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Config:
|
||||
"""Configuration class for Discord Rare Monitor Bot."""
|
||||
|
||||
# Discord Configuration
|
||||
DISCORD_TOKEN: str = os.getenv('DISCORD_RARE_BOT_TOKEN', '')
|
||||
COMMON_RARE_CHANNEL_ID: int = int(os.getenv('COMMON_RARE_CHANNEL_ID', '1355328792184226014'))
|
||||
GREAT_RARE_CHANNEL_ID: int = int(os.getenv('GREAT_RARE_CHANNEL_ID', '1353676584334131211'))
|
||||
|
||||
# WebSocket Configuration
|
||||
WEBSOCKET_URL: str = os.getenv('DERETH_TRACKER_WS_URL', 'ws://dereth-tracker:8765/ws/position')
|
||||
|
||||
# Logging Configuration
|
||||
LOG_LEVEL: str = os.getenv('LOG_LEVEL', 'INFO').upper()
|
||||
|
||||
# Rare Classification Configuration
|
||||
COMMON_RARE_KEYWORDS: list = ["Crystal", "Jewel", "Pearl", "Elixir", "Kit"]
|
||||
|
||||
# WebSocket Retry Configuration
|
||||
INITIAL_RETRY_DELAY: int = 5 # seconds
|
||||
MAX_RETRY_DELAY: int = 300 # 5 minutes
|
||||
|
||||
@classmethod
|
||||
def validate(cls) -> list:
|
||||
"""Validate configuration and return list of errors."""
|
||||
errors = []
|
||||
|
||||
if not cls.DISCORD_TOKEN:
|
||||
errors.append("DISCORD_RARE_BOT_TOKEN environment variable is required")
|
||||
|
||||
if not cls.WEBSOCKET_URL:
|
||||
errors.append("DERETH_TRACKER_WS_URL environment variable is required")
|
||||
|
||||
try:
|
||||
cls.COMMON_RARE_CHANNEL_ID = int(cls.COMMON_RARE_CHANNEL_ID)
|
||||
except (ValueError, TypeError):
|
||||
errors.append("COMMON_RARE_CHANNEL_ID must be a valid integer")
|
||||
|
||||
try:
|
||||
cls.GREAT_RARE_CHANNEL_ID = int(cls.GREAT_RARE_CHANNEL_ID)
|
||||
except (ValueError, TypeError):
|
||||
errors.append("GREAT_RARE_CHANNEL_ID must be a valid integer")
|
||||
|
||||
return errors
|
||||
|
||||
@classmethod
|
||||
def log_config(cls, logger):
|
||||
"""Log current configuration (excluding sensitive data)."""
|
||||
logger.info("🔧 Discord Rare Monitor Configuration:")
|
||||
logger.info(f" WebSocket URL: {cls.WEBSOCKET_URL}")
|
||||
logger.info(f" Common Rare Channel ID: {cls.COMMON_RARE_CHANNEL_ID}")
|
||||
logger.info(f" Great Rare Channel ID: {cls.GREAT_RARE_CHANNEL_ID}")
|
||||
logger.info(f" Log Level: {cls.LOG_LEVEL}")
|
||||
logger.info(f" Common Keywords: {cls.COMMON_RARE_KEYWORDS}")
|
||||
logger.info(f" Discord Token: {'✅ Set' if cls.DISCORD_TOKEN else '❌ Not Set'}")
|
||||
|
||||
|
||||
# Global config instance
|
||||
config = Config()
|
||||
Loading…
Add table
Add a link
Reference in a new issue