Skip to content

Discord Features Overhaul + Wiki Auto-Setup Deployment #8

@Xerialen

Description

@Xerialen

Summary

Major feature overhaul across both QWICKY repos, deployed 2026-03-29. Inspired by comparing with kindzal/qw-tourney-management (QWadmin).

Discord Features (4 phases + stretch goal)

Phase 1: Notification Queue Infrastructure

  • New discord_notifications Supabase table with atomic claim_notifications() RPC
  • Bot polls every 30s, dispatches to type-specific handlers
  • discord_message_id stored on submissions for later editing
  • Submission feedback: Discord embeds update to green/red when admin approves/rejects

Phase 2: Schedule Posting

  • Discord icon button on each round header in the Schedule tab
  • Posts formatted embed with matchups, dates, best-of to all registered channels
  • post_schedule notification handler in bot

Phase 3: Automated Reminders + Settings

  • Game day reminders — daily 09:00 UTC embed listing today's matches (blue)
  • Unscheduled match alerts — warning about dateless matches (orange)
  • Admin alerts — stale pending submissions > 3 days
  • Discord Features panel in TournamentInfo with 4 toggles
  • All gated by per-tournament settings.discord.* flags
  • 7-day cleanup of old completed/failed notifications

Phase 4: Discovery Summaries + Interactive Buttons

  • Discovery candidates posted to Discord with color-coded confidence embeds
  • Approve/Reject buttons on each candidate (Discord ActionRow components)
  • Button interaction handler updates match_submissions status + edits embed
  • "Post to Discord" button alongside "Import Selected" in discovery UI

Stretch: Schedule-via-Discord

  • Bot detects messages with two team names + a date in registered channels
  • Natural language date parser: next monday 20:00 CET, thursday 9pm, tomorrow, 15 april, ISO dates
  • Posts confirmation embed with Confirm/Cancel buttons
  • On confirm, updates match_date in Supabase

Auto-Discovery (Scheduled Execution)

  • Discovery settings panel in TournamentInfo: enable/schedule/threshold/tagPatterns/autoImport
  • run-discovery endpoint — calls discover-games, deduplicates against existing data, enqueues Discord notifications, optionally auto-imports high-confidence games
  • Bot scheduler — 22:00 UTC, supports daily/twice-weekly/weekly/manual per tournament
  • discovery_runs table — run history with 12-hour cooldown
  • "Run Now" button for immediate manual trigger

Wiki Auto-Setup (Deployment + Verification)

  • Vercel deployment fixed — consolidated 22 serverless functions → 12 (Hobby plan limit)
  • Wiki endpoints → api/wiki.mjs?action=..., Discord endpoints → api/discord.mjs?action=...
  • All 9 E2E wiki tests passing (markup generation, 3-division publish, setup wizard)
  • Wiki env vars confirmed on Vercel (WIKI_BOT_USERNAME, WIKI_BOT_PASSWORD, WIKI_API_URL)

UX Improvement

  • App auto-skips landing page when localStorage has tournament with divisions (better UX + fixes E2E tests)

Architecture

Web App (admin action) → INSERT discord_notifications → Bot polls (30s) → Discord
Bot scheduler (22:00 UTC) → POST /api/discord?action=run-discovery → Web App → Discord

All Discord features use wizard-ready settings structure at tournaments.settings.discord and tournaments.settings.discovery.

Commits

qwicky (web app): 7 commits
qwicky-discord-bot: 7 commits
Supabase: 2 migrations (discord_notifications, discovery_runs)

New Files

Bot

  • src/services/notificationPoller.js — queue processor
  • src/services/buttonHandler.js — Discord button interactions
  • src/services/dailyReminders.js — game day / unscheduled / admin alerts
  • src/services/discoveryScheduler.js — scheduled discovery runs
  • src/services/handlers/ — editSubmission, postSchedule, gameDayReminder, unscheduledAlert, adminAlert, discoverySummary
  • src/listeners/scheduleParser.js — team+date message detection
  • src/utils/dateParser.js — natural language date parsing

Web App

  • api/discord.mjs — consolidated Discord endpoint (post-schedule, post-discovery, run-discovery, channels)
  • api/wiki.mjs — consolidated wiki endpoint (scan, scaffold, publish, auto-publish, config)

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions