Repository navigation
Add sports-score-alert ability: live scores, schedules, and results via ESPN - #344
Conversation
…or MLB, NBA, NFL, NHL, MLS via ESPN
🔀 Branch Merge CheckPR direction: ✅ Passed — |
✅ Community PR Path Check — PassedAll changed files are inside the |
✅ Ability Validation Passed |
🔍 Lint Results✅
|
Signed-off-by: Uzair Ullah <uzairullahmail@gmail.com>
Refactor data saving logic to check success of operations and adjust worker initialization. Signed-off-by: Uzair Ullah <uzairullahmail@gmail.com>
uzair401
left a comment
There was a problem hiding this comment.
Thanks @hassan1731996 — this is your second PR with the same storage bug as air-quality-pollen-alert, so worth calling out clearly: please follow these patterns going forward, since they'll come up in every future ability.
- Storage saves must be
create_key-first, checking the actualsuccessfield in the response.try: update_key(...) except: create_key(...)looks reasonable but is broken —update_keydoesn't raise and just no-ops on a missing key, so the very first save silently never persists. - Exit-word matching needs to check the whole utterance, not do a substring/word check across
EXIT_WORDS. In a sports context, "stop" and "done" show up constantly in ordinary sentences ("what a stop by the goalie," "is it done yet") — a plain match exits the ability mid-conversation. It also meant "stop following the Yankees" always exited instead of reaching your ownUNFOLLOWhandling. - Daemon
call()must setbackground_daemon_modebefore constructingCapabilityWorker, and daemons should passself, notself.worker.
Fixed all of these plus the identical background.py copy. Everything else here (the ESPN integration, the team-collision keyword matching, the in-memory-data workaround for the create_key visibility lag) is genuinely well thought out — these three patterns are just worth locking in for next time.
Summary
Trigger phrases
"sports scores","how did [team] do","when does [team] play","track my teams", and moreTest plan
"track my teams"→ setup flow, team names saved"how did the Yankees do"→ last result returned"when do the Red Sox play"→ next scheduled game within 3 days"what's the score"→ live score if game in progressvalidate_ability.pypasses (exit 0)