Add --check preflight to validate config and connectivity

`python -m gaming_deals_bot --check` tests each external dependency
before starting the bot:

- Matrix: verifies access token (whoami) and room membership
- CheapShark: hits the deals endpoint
- Epic Games Store: hits the free-games endpoint
- Frankfurter: fetches exchange rates
- IsThereAnyDeal: validates the API key (skipped if not set)

Exits 0/1 so it works in CI pipelines and Docker health-checks.

https://claude.ai/code/session_01LPpSZFfyh6vdV5HGFWjoQX
This commit is contained in:
Claude
2026-02-28 01:52:48 +00:00
parent d5f30487cb
commit 016d2c1973
3 changed files with 208 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ from apscheduler.schedulers.asyncio import AsyncIOScheduler
from .bot import DealsBot
from .config import Config
from .preflight import run_preflight
def setup_logging():
@@ -23,12 +24,18 @@ async def main():
setup_logging()
logger = logging.getLogger("gaming_deals_bot")
check_mode = "--check" in sys.argv
try:
config = Config()
except ValueError as exc:
logger.error("Configuration error: %s", exc)
sys.exit(1)
if check_mode:
ok = await run_preflight(config)
sys.exit(0 if ok else 1)
bot = DealsBot(config)
await bot.start()