Skip to content

Implement: libowski-bot-fix-vikes-tv.md - #4

Merged
emb417 merged 1 commit into
mainfrom
vault-spec/libowski-bot-fix-vikes-tv
Aug 31, 2026
Merged

emb417 merged 1 commit into
mainfrom
vault-spec/libowski-bot-fix-vikes-tv

Conversation

@emb417

@emb417 emb417 commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Auto-generated from vault spec notes/libowski-bot-fix-vikes-tv.md.

The view-vikes-tv slash command was recently updated to also extract and display TV
network info per game. After that change, the command now returns "No Vikings games
found on the schedule" — it finds zero games at all. Before this change, the command
correctly found and displayed the next several upcoming games (just without TV info).

Look at the current implementation in src/commands/view-vikes-tv.js. The recent change
refactored the parsing to iterate over div.nfl-o-matchup-cards elements to correlate
game data with broadcast info — this refactor likely broke the game-matching logic
itself, not just the TV extraction. Fix the command so it correctly finds and displays
upcoming games again, with TV network info included where available (fall back to "TBD"
if not found, as before).


Expanded Spec

Problem

The /view-vikes-tv slash command, after a recent refactor to include TV network information, now fails to find any Vikings games on the schedule, returning "No Vikings games found on the schedule." Previously, it correctly identified and displayed upcoming games. The issue is likely in the updated Cheerio parsing logic within src/commands/view-vikes-tv.js, specifically how div.nfl-o-matchup-cards elements and their nested script[type="application/ld+json"] data are identified and processed. The current parsing results in games.length being zero. Additionally, the EmbedBuilder section for formatting game details is incomplete.

Acceptance Criteria

  • The /view-vikes-tv command executes successfully and replies to the user.
  • The command successfully scrapes https://www.vikings.com/schedule/ to identify upcoming Minnesota Vikings games.
  • It displays a formatted list of upcoming games in a Discord embed.
  • Each listed game includes its date, opponent, and time.
  • TV network information is extracted and displayed for each game where available.
  • If TV network information cannot be found for a game, it displays "TBD" for that game's broadcast.
  • If, after parsing the page, no games are found, the command replies with "🏈 No Vikings games found on the schedule."
  • If games are found but none are in the future, the command replies with "🏈 No upcoming Vikings games found."

Notes for implementer

  • Inspect HTML: Begin by manually inspecting the HTML structure of https://www.vikings.com/schedule/ in a browser's developer tools. Look for div.nfl-o-matchup-cards and the presence/structure of script[type="application/ld+json"] within them, as well as the .nfl-o-matchup-cards__media-tv--networks class for TV info. The page structure might have changed, rendering the current Cheerio selectors invalid or incomplete.
  • Game Identification: The primary issue is games.length being 0. Focus on why $('div.nfl-o-matchup-cards') might not be selecting elements, or why the subsequent json extraction and @type check (if ($jsonScript.length === 0) return; or if (json["@type"] === "SportsEvent")) might be failing.
  • TV Info Extraction: After fixing game identification, ensure .nfl-o-matchup-cards__media-tv--networks still correctly targets the TV network text. Fallback to "TBD" if it's missing.
  • Complete Embed Formatting: The src/commands/view-vikes-tv.js file has an incomplete EmbedBuilder section. You'll need to complete the dateStr formatting and add embed.addFields(...) to correctly display the game details (dateStr, opponent, time, TV info) for each upcomingGame. Consider using Intl.DateTimeFormat for robust date/time formatting.

@emb417 emb417 added the patch Patch-level semver bump label Aug 31, 2026
@emb417
emb417 merged commit 5d36dc1 into main Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Patch-level semver bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant