- src/services/wikijsSync.js: GraphQL client for Wiki.js at subscribers.firefrostgaming.com
- syncWikiUser(discordId, username, tierLevel): creates user if not exists, updates group if exists
- demoteToAwakened(discordId): downgrades group on cancellation/chargeback/refund
- Email convention: {discordId}@firefrost.local (unique internal addresses)
- Tier → group mapping: 1=Awakened, 2=Elemental, 3=Knight, 4=Master, 5=Legend, 6=Sovereign
- Silent-fail: never breaks the Stripe webhook
- src/routes/stripe.js: hooked into 4 lifecycle paths:
- checkout.session.completed → syncWikiUser (non-blocking)
- customer.subscription.deleted → demoteToAwakened
- charge.dispute.created (chargeback) → demoteToAwakened
- charge.refunded (refund ban) → demoteToAwakened
- .env.example: added WIKIJS_URL, WIKIJS_API_KEY, DISCORD_ISSUE_WEBHOOK_URL
PRE-REQ: Michael must create 6 groups in Wiki.js admin + generate API key before deploy.
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
# Discord Core
|
|
DISCORD_BOT_TOKEN=your_bot_token
|
|
GUILD_ID=your_guild_id
|
|
DISCORD_CLIENT_ID=your_client_id
|
|
DISCORD_CLIENT_SECRET=your_client_secret
|
|
|
|
# OAuth & Admin
|
|
REDIRECT_URI=https://discord-bot.firefrostgaming.com/auth/discord/callback
|
|
ADMIN_USERS=discord_id_1,discord_id_2
|
|
SESSION_SECRET=your_secure_session_secret
|
|
PORT=3500
|
|
NODE_ENV=production
|
|
|
|
# PostgreSQL Database
|
|
DB_USER=arbiter
|
|
DB_HOST=127.0.0.1
|
|
DB_NAME=arbiter_db
|
|
DB_PASSWORD=your_secure_password
|
|
DB_PORT=5432
|
|
|
|
# Pterodactyl Integration
|
|
PANEL_URL=https://panel.firefrostgaming.com
|
|
PANEL_CLIENT_KEY=ptlc_...
|
|
PANEL_APPLICATION_KEY=ptla_...
|
|
MINECRAFT_NEST_IDS=1,6,7
|
|
|
|
# Stripe Integration
|
|
STRIPE_SECRET_KEY=sk_test_... # or sk_live_... for production
|
|
STRIPE_WEBHOOK_SECRET=whsec_... # Get from Stripe Dashboard webhook settings
|
|
BASE_URL=https://discord-bot.firefrostgaming.com # For checkout redirect URLs
|
|
|
|
# Wiki.js Subscriber Wiki (subscribers.firefrostgaming.com)
|
|
# Generate key in Wiki.js Admin → API Access. Groups (Awakened thru Sovereign)
|
|
# must be pre-created in Wiki.js admin panel before syncing.
|
|
WIKIJS_URL=https://subscribers.firefrostgaming.com
|
|
WIKIJS_API_KEY=
|
|
|
|
# Discord Webhooks (optional — silent-skip if unset)
|
|
DISCORD_ISSUE_WEBHOOK_URL=
|