Skip to content

Commit 01e59d6

Browse files
Andrewclaude
andcommitted
Initial commit: Secret Lair Drop Monitor
Discord webhook monitor for Secret Lair store, Chaos Vault, and Shop All pages. Dockerized with compose support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 parents  commit 01e59d6

7 files changed

Lines changed: 543 additions & 0 deletions

File tree

.env.example

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Secret Lair Monitor Configuration
2+
# Copy this to .env and fill in your values.
3+
# Each line must be in KEY=VALUE format (no quotes needed around values).
4+
5+
# REQUIRED: Discord webhook URL
6+
# Create one in Discord: Server Settings > Integrations > Webhooks > New Webhook
7+
# Replace the placeholder below with your full webhook URL, e.g.:
8+
# DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/1234567890/aBcDeFgHiJkLmNoPqRsT
9+
DISCORD_WEBHOOK_URL=
10+
11+
# Poll interval in seconds (default: 180 = 3 minutes)
12+
# Be reasonable — too aggressive and you may get rate limited or blocked
13+
POLL_INTERVAL_SECONDS=300
14+
15+
# Also monitor the /us/shopall page (default: true)
16+
# This catches products that may not appear on the homepage
17+
MONITOR_SHOP_ALL=true
18+
19+
# Send Discord notifications for all existing products on first run (default: false)
20+
# Set to true if you want a full dump of current products on startup
21+
NOTIFY_ON_START=false
22+
23+
# Log verbosity: DEBUG, INFO, WARNING, ERROR
24+
LOG_LEVEL=INFO

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.env
2+
data/

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM python:3.12-slim
2+
3+
WORKDIR /app
4+
5+
# Install deps first for layer caching
6+
COPY requirements.txt .
7+
RUN pip install --no-cache-dir -r requirements.txt
8+
9+
COPY monitor.py .
10+
11+
# State persisted to /data via volume mount
12+
VOLUME /data
13+
14+
ENV PYTHONUNBUFFERED=1
15+
16+
CMD ["python", "monitor.py"]

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Secret Lair Drop Monitor
2+
3+
Monitors the [Secret Lair](https://secretlair.wizards.com/us/) store and [Chaos Vault](https://secretlair.wizards.com/us/chaosvault) for new product drops. Sends notifications to a Discord channel via webhook when new items appear.
4+
5+
## What it monitors
6+
7+
- **Main store** (`/us/`) — Featured drops and homepage products
8+
- **Chaos Vault** (`/us/chaosvault`) — Detects when the vault opens/closes and alerts immediately
9+
- **Shop All** (`/us/shopall`) — Catches products that may not be on the homepage (optional, enabled by default)
10+
11+
## Features
12+
13+
- Detects new product additions by tracking product IDs
14+
- Special "CHAOS VAULT IS OPEN" alert when the vault transitions from closed to active
15+
- Rich Discord embeds with product name, price, and direct link
16+
- Persists state across restarts (won't re-notify on reboot)
17+
- First run silently catalogues existing products (no spam on initial deploy)
18+
- Rate-limit aware for Discord API
19+
20+
## Setup
21+
22+
### 1. Create a Discord Webhook
23+
24+
In your Discord server: **Server Settings > Integrations > Webhooks > New Webhook**
25+
26+
Pick the channel you want alerts in, copy the webhook URL.
27+
28+
### 2. Configure
29+
30+
```bash
31+
cp .env.example .env
32+
```
33+
34+
Edit `.env` and set your webhook URL:
35+
36+
```
37+
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/1234567890/aBcDeFgHiJkLmNoPqRsT
38+
```
39+
40+
### 3. Deploy
41+
42+
```bash
43+
docker compose up -d
44+
```
45+
46+
Check logs:
47+
```bash
48+
docker compose logs -f
49+
```
50+
51+
## Configuration
52+
53+
All config is via environment variables (set in `.env`):
54+
55+
| Variable | Default | Description |
56+
|---|---|---|
57+
| `DISCORD_WEBHOOK_URL` | *(required)* | Discord webhook URL |
58+
| `POLL_INTERVAL_SECONDS` | `180` | Seconds between checks |
59+
| `MONITOR_SHOP_ALL` | `true` | Also monitor `/us/shopall` |
60+
| `NOTIFY_ON_START` | `false` | Notify for existing products on first run |
61+
| `LOG_LEVEL` | `INFO` | Log verbosity |
62+
63+
## How It Works
64+
65+
1. On startup, fetches all monitored pages and parses product links from the HTML
66+
2. Product IDs (the numeric ID in `/us/product/1249999`) are the unique key
67+
3. First run stores all current products silently (no notification flood)
68+
4. Subsequent checks compare against known state — new IDs trigger Discord alerts
69+
5. The Chaos Vault page is checked for whether it has any product listings. When products appear, a special high-visibility alert fires.
70+
6. State is written to `state.json` after every cycle
71+
72+
## Troubleshooting
73+
74+
**No notifications on first run** — This is by design. Set `NOTIFY_ON_START=true` if you want alerts for existing products.
75+
76+
**Products not detected** — The scraper looks for `/us/product/{id}` links in the HTML. If Wizards changes their URL structure or moves to fully client-rendered content, the regex patterns may need updating. Check logs at `LOG_LEVEL=DEBUG`.
77+
78+
**Rate limited** — The monitor handles Discord 429 responses automatically. If the site itself rate-limits you, increase `POLL_INTERVAL_SECONDS`.
79+
80+
**State reset** — Delete the `data/` directory to start fresh. The next run will re-catalogue everything.

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
secretlair:
3+
build: .
4+
container_name: secretlair
5+
restart: unless-stopped
6+
env_file: .env
7+
volumes:
8+
- ./data:/data

0 commit comments

Comments
 (0)