Skip to content

feat: add gateway scheduled events, stage instances, and soundboard sounds - #110

Merged
RedStar071 merged 1 commit into
feat/moderationfrom
feat/guild-events
Sep 25, 2026
Merged

RedStar071 merged 1 commit into
feat/moderationfrom
feat/guild-events

Conversation

@RedStar071

Copy link
Copy Markdown
Member

Stacked on #109.

🔗 Linked issue

Related to #54 (phase 11b of the roadmap).

🧭 Context

The cache already stored scheduled events, stage instances and soundboard sounds, but nothing read them: no structures, no managers, and their dispatches only reached raw.

📚 Description

They now follow discord.js, on the same per-guild manager pattern as bans and rules:

  • Scheduled events. GuildScheduledEvent and guild.scheduledEvents with fetchAll, create, edit, delete and fetchSubscribers. The event has discord.js's setters (setName, setStatus, setLocation, the schedule times, ...), the status checks, url and coverImageURL. Subscribers come with their user and, with withMember, their member, and both are cached.
  • Stage instances. StageInstance and guild.stageInstances, keyed by stage channel like the cache. StageChannel#createStageInstance and #fetchStageInstance return null when the stage isn't live, since Discord answers 404.
  • Soundboard. SoundboardSound and guild.soundboardSounds (fetchAll, create, edit, delete). client.fetchDefaultSoundboardSounds() lists Discord's own sounds, and VoiceChannel#sendSoundboardSound plays one. Default sounds have no guild, so editing or deleting them rejects.
  • Events: create/update/delete for all three, guildScheduledEventUserAdd/Remove, guildSoundboardSoundsUpdate and soundboardSounds.

One plugin-cache fix: GUILD_SCHEDULED_EVENT_CREATE/UPDATE now upserts the event's creator into users, like discord.js does. Without it, the subscription events couldn't resolve their user from the cache.

Left for phase 11c: templates, welcome screen, widget, onboarding and integrations, then multi-process sharding.

Key changes

Area Change
Structures GuildScheduledEvent, StageInstance, SoundboardSound; StageChannel and VoiceChannel methods; Guild accessors
Managers GuildScheduledEventManager, StageInstanceManager, GuildSoundboardSoundManager, client.fetchDefaultSoundboardSounds
Events Scheduled event, stage instance and soundboard events
@wolfstar/plugin-cache Scheduled event creators cached in users

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change
  • Workflow / CI change

Pre-flight Checklist

  • I have read the Contributing Guidelines (if applicable)
  • My code follows the code style of this project
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly
  • I added a changeset with pnpm changeset (or pnpm changeset add --empty if no release is needed). See .changeset/README.md.

🤖 AI disclosure: Wolfstar Agent Kit modified this description. My AI open-source policy.

@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

◈ PR Lens

🟢 +4 new · 🟠 ~3 changed · 🔴 -0 removed · 2 flows · 22 files · commit ff21ace


Architecture

Architecture diagram for wolfstar-project/plugins at ff21ace

7 components touched across 4 lanes.

Play the interactive walkthrough


Inside the changed components — 2 views

Component view — Scheduled events and stages

Managers, structures, and cache operations for scheduled guild events and stage instances.

Architecture view of Component view — Scheduled events and stages in wolfstar-project/plugins

Component view — Soundboard sounds

Managers, structures, and voice channel integration for guild and default soundboard sounds.

Architecture view of Component view — Soundboard sounds in wolfstar-project/plugins

Data flow

Data flow diagram for wolfstar-project/plugins at ff21ace

Creating and caching a scheduled event · Gateway event dispatch and hydration

Follow each request, response and payload


The other flows — 1 sequence

Gateway event dispatch and hydration

Sequence diagram of Gateway event dispatch and hydration in wolfstar-project/plugins

View

  • Architecture lens
  • Data flow lens
  • Expand every detail

Tip

The CLI's render reads .github/pr-lens.yml and applies your renames, exclusions and lane pins at draw time

🪧 More tips
  • Run npx skills add coldteadotai/pr-lens, then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Run npx @coldtea/pr-lens-cli analyze --base origin/main on a branch, then npx @coldtea/pr-lens-cli render .pr-lens/graph.json. Same lenses, your own model key, before the pull request exists
  • Untick Architecture lens or Data flow lens under View to hide a diagram, or tick Expand every detail to open every section. The comment redraws in a few seconds
  • Click the link under each diagram to open it on a canvas you can zoom, pan and step through
  • The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change
  • Open a diagram on the canvas, then press W or click play to walk through the change one step at a time
  • Set github.comment.collapsed: true in .github/pr-lens.yml to fold the comment behind one View architecture and data flow row. Drawing still runs on every push
  • Set github.draw: on-demand in .github/pr-lens.yml and PR Lens stops drawing every push. Comment @pr-lens draw on a pull request when you want that one drawn
  • Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and your model provider's key as its api-key to run PR Lens from your own CI. Any /chat/completions endpoint works
  • Push a commit and the comment redraws for the new head. A slow older run never overwrites a newer one
  • Switch GitHub to dark mode and the diagrams follow. The moving dots are this pull request's data in motion

Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the full diff (21 files, 1 commit) adding scheduled events, stage instances, and soundboard sounds to @wolfstar/plugin-gateway, following the repo's established per-guild CachedManager pattern.

  • GuildScheduledEvent / GuildScheduledEventManager (guild.scheduledEvents) — fetchAll, create, edit, delete, fetchSubscribers, discord.js-style setters, status checks, url, coverImageURL.
  • StageInstance / StageInstanceManager (guild.stageInstances, keyed by stage channel ID) — StageChannel#createStageInstance/#fetchStageInstance, the latter returning null on Discord's 404 for a non-live stage.
  • SoundboardSound / GuildSoundboardSoundManager (guild.soundboardSounds) — fetchAll, create, edit, delete; client.fetchDefaultSoundboardSounds(); VoiceChannel#sendSoundboardSound; default (guildless) sounds reject edit/delete.
  • Dispatch/event wiring — create/update/delete handlers for all three in util/dispatch.ts, plus guildScheduledEventUserAdd/Remove, guildSoundboardSoundsUpdate, soundboardSounds, with corresponding GatewayEventMap entries and README docs.
  • plugin-cache fix — GUILD_SCHEDULED_EVENT_CREATE/UPDATE now also upserts the event's creator into the users store, so the new subscription-event handlers can resolve the user from cache.

I cross-checked every REST route, REST body type, and gateway dispatch payload type used in this PR directly against the vendored [email protected] source rather than trusting the diff at face value:

  • Delete dispatches for scheduled events and stage instances carry the full object (GatewayGuildScheduledEventDeleteDispatchData/GatewayStageInstanceDeleteDispatchData = APIGuildScheduledEvent/APIStageInstance), so hydrating straight from data without a before snapshot is correct. GUILD_SOUNDBOARD_SOUND_DELETE's dispatch data is ID-only ({sound_id, guild_id}), and that handler correctly uses a before cache read + emits previous ?? null — matching the "snapshot before cache write" pattern the rest of the dispatch table already uses for removal events.
  • GuildSoundboardSoundCreate/Update's dispatch data types are untyped aliases of APISoundboardSound (guild_id is optional in the type, even though guild-scoped dispatches always carry it) — the data.guild_id! assertions in dispatch.ts are factually justified, not a hallucinated guarantee.
  • All new Routes.* calls (guildScheduledEvent*, stageInstance*, *soundboardSound*, sendSoundboardSound, soundboardDefaultSounds) and REST body shapes (RESTPost/PatchAPIGuildScheduledEventJSONBody, soundboard/stage equivalents) match the real route builders and field names.
  • edit()/delete() on the three new structures follow the codebase-wide convention (this[kPatch](x.toJSON()) / return this;) exactly.
  • tests/guild-events.test.ts asserts exact converted REST bodies, exact emitted event args, and the 404→null fallback — meaningful coverage, not tautological.

No correctness issues found.

Pullfrog  | View workflow run | Using Claude Sonnet | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@wolfstar/plugin-api

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-api@110

@wolfstar/plugin-cache

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-cache@110

@wolfstar/plugin-gateway

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-gateway@110

@wolfstar/plugin-i18next

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-i18next@110

@wolfstar/plugin-logger

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-logger@110

@wolfstar/plugin-subcommands-advanced

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-subcommands-advanced@110

commit: ff21ace

@pullfrog

pullfrog Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Your Claude subscription has hit its usage limit. It resets at 7:20pm (UTC). Re-trigger Pullfrog after the reset, or add an ANTHROPIC_API_KEY repo secret — Pullfrog routes around an exhausted subscription automatically when one is present.

Add repo secret → · Model settings → · Setup docs → · Ask in Discord →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using Claude Sonnet | 𝕏

@pullfrog

pullfrog Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Your Claude subscription has hit its usage limit. It resets at 7:20pm (UTC). Re-trigger Pullfrog after the reset, or add an ANTHROPIC_API_KEY repo secret — Pullfrog routes around an exhausted subscription automatically when one is present.

Add repo secret → · Model settings → · Setup docs → · Ask in Discord →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using Claude Sonnet | 𝕏

@RedStar071
RedStar071 merged commit 769d943 into main Sep 25, 2026
19 of 26 checks passed
@RedStar071
RedStar071 deleted the feat/guild-events branch September 25, 2026 18:02
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