Skip to content

Add YouTube notifications to the notify hybrid group - #10

Open
goodmorningkay wants to merge 1 commit into
crygup:rewritefrom
goodmorningkay:add-youtube-notify-commands
Open

Add YouTube notifications to the notify hybrid group#10
goodmorningkay wants to merge 1 commit into
crygup:rewritefrom
goodmorningkay:add-youtube-notify-commands

Conversation

@goodmorningkay

Copy link
Copy Markdown
Contributor

Summary

Extend the notify hybrid group with YouTube channel follows. Users can now follow a YouTube channel and choose whether to be notified for uploads, live streams, or both, in a server or by DM — mirroring the existing Twitch/anime command structure.

What was added

Commands (all hybrid, guild + DM)

  • notify add youtube <channel> [events]events = uploads / live / both (default both), with channel-search autocomplete
  • notify youtube <channel> [events] — shorthand for the above
  • notify remove youtube <follow> — by follow ID, channel name, or channel URL
  • notify mention youtube <follow> [mention] — set/clear a role or @everyone mention
  • notify events youtube <follow> <events> — change an existing follow's event type
  • notify list youtube — list followed channels; YouTube also appears as a section in notify list
  • notify channel youtube — guild-only routing to a server text channel
  • Autocomplete for channel search, followed channels, mention roles, and text channels

Backend (extensions/events/youtube.py)

  • _dispatch_youtube_item now selects user_id, mention_role_id, mention_everyone
  • New _youtube_owner + _youtube_destination resolve a follow's channel or DM destination
  • Delivery dedup claims by guild or user scope via partial unique indexes
  • Announcements honor per-follow mentions (notify_allowed_mentions) and can DM the owner
  • New search_youtube_channels (Google API) for add autocomplete

Migration 0093_youtube_notify_follows.sql

  • youtube_follows: adds user_id, an id identity primary key, mention_role_id/mention_everyone; the (guild_id, youtube_channel_id) primary key becomes a UNIQUE constraint so DM rows fit while the website's ON CONFLICT (guild_id, youtube_channel_id) inserts keep working
  • youtube_announcement_deliveries: adds user_id and scope-keyed partial unique indexes for DM delivery dedup

Other

  • youtube_follows added to USER_ID_TABLES in core/privacy.py for GDPR wipes
  • notify list / landing text updated to mention YouTube

Testing

  • New tests/test_notify_youtube.py covering event mapping, list rendering, owner/destination resolution, and guild vs DM delivery-claim scoping
  • Full suite: 1328 tests pass
  • Migration validated against Postgres 18 (guild + DM inserts, ON CONFLICT, owner check, id auto-increment, delivery dedup by both scopes, and the runtime claim SQL partial-index match)
  • Cog-load smoke test confirms all youtube subcommands register under add/remove/mention/events/list/channel; notify add youtube exposes channel + events params
  • Ruff clean

Notes

  • notify list section order is Twitch → YouTube → Anime
  • The short/community event types still work via the website API but are not exposed as command choices

Extend the notify group with YouTube channel follows supporting
uploads/live/both event choices, guild and DM scoping, mentions,
channel routing, and event-type editing. Mirrors the existing
Twitch/anime command structure.

- notify add youtube <channel> [events], notify youtube shorthand
- notify remove/mention/events/list/channel youtube
- youtube_follows gains user_id, id identity PK, mention columns;
  guild PK becomes UNIQUE so DM rows fit and website ON CONFLICT holds
- youtube_announcement_deliveries gains user_id + scope-keyed partial
  unique indexes for DM delivery dedup
- delivery resolves channel vs DM destination and honors per-follow
  mentions; channel search autocomplete via Google API
- youtube_follows added to privacy USER_ID_TABLES
- tests for event mapping, list rendering, owner/destination, and
  guild vs DM delivery claim scoping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant