Skip to content

Split player presence events into a #player-events channel - #62

Merged
HandyS11 merged 8 commits into
developfrom
feat/player-events-channel
Jul 23, 2026
Merged

Split player presence events into a #player-events channel#62
HandyS11 merged 8 commits into
developfrom
feat/player-events-channel

Conversation

@HandyS11

Copy link
Copy Markdown
Owner

What

Team-player presence events (join, disconnect, death, respawn, AFK) now post to a new per-server #player-events Discord channel instead of the shared #events channel.

#events keeps map events (cargo ship, patrol helicopter, chinook, oil rigs) and wipe announcements. The in-game Rust team-chat broadcast is unchanged for both feeds — the same lines still go to team chat.

How

Channels here are declarative, so the split is a new key + a new locator rather than a code move — Features.Players already owned its own relay.

  • WorkspaceChannelKeys.ServerPlayerEvents = "playerevents", declared as a read-only ChannelSpec at Order 5. map/switches/alarms/storagemonitors shift to 6–9; events stays at 4.
  • IPlayerEventChannelLocator + a one-line CachingChannelLocator subclass, mirroring IEventChannelLocator/EventChannelLocator.
  • PlayerEventRelay swaps that single injected dependency. Nothing inside RelayAsync changes.
  • Channel names: player-events (en) / evenements-joueurs (fr).

EventRelay, WipeAnnouncer, EventChannelLocator and their tests are untouched — they are the regression proof that in-game events did not move.

Deployment

No migration. WorkspaceReconciler creates the channel in every existing per-server category on the next reconcile and EnsureChannelOrderAsync permutes the existing position slots once, so channels outside the managed block keep their relative places. Historical messages stay in #events.

Between deploy and first reconcile — plus up to the locator's 30s cache TTL — presence events go in-game only and are not backfilled to Discord. That matches how every other channel behaves on introduction.

Testing

Full suite: 1245 passed, 1 skipped across 19 projects.

  • ServerChannelSpecTests pins the channel set, the full ordering sequence, and Order uniqueness.
  • PlayerEventChannelLocatorTests seeds both an events row (888) and a playerevents row (777) and asserts 777 — it fails if the locator reads the wrong key.
  • PlayerEventRelayTests still covers the null-channel branch (in-game line sent, no Discord post) and the resolved-channel branch.
  • The compiler enforces the rest: PlayerEventRelay's constructor only accepts IPlayerEventChannelLocator.

Verified against real code during review: teardown/purge is key-agnostic so the new channel is cleaned up like its siblings, and there is no playerevents/events collision — the store matches ChannelKey with == only and channel adoption uses exact name equality.

Design: docs/superpowers/specs/2026-07-22-player-events-channel-design.md

🤖 Generated with Claude Code

HandyS11 and others added 8 commits July 22, 2026 22:43
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Swap PlayerEventRelay's injected locator from IEventChannelLocator to
IPlayerEventChannelLocator so player transitions (login/logout/death/AFK)
resolve the #player-events channel instead of #events. Constructor arity,
RelayAsync body, and the in-game team-chat send path are unchanged.

Also bumps the StringsResourceParityTests sentinel count (365 -> 366) to
account for the channel.playerevents.name key already added in Task 1;
the sentinel was left stale and was failing dtk dotnet test RustPlusBot.slnx.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 21:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces a new per-server Discord channel (#player-events) to separate team-player presence notifications (join/disconnect/death/respawn/AFK) from the existing #events channel, while keeping the in-game team chat broadcast behavior unchanged.

Changes:

  • Added a new workspace channel key/spec (playerevents) and localized channel names (player-events / evenements-joueurs) with ordering between #events and #map.
  • Introduced IPlayerEventChannelLocator + PlayerEventChannelLocator and registered it in workspace DI.
  • Updated PlayerEventRelay (and related tests/registrations/docs) to resolve/post presence embeds to #player-events instead of #events.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/RustPlusBot.Localization.Tests/StringsResourceParityTests.cs Updates expected resource-key catalog count after adding new localization entry.
tests/RustPlusBot.Features.Workspace.Tests/WorkspaceRegistrationTests.cs Asserts the new locator interface is registered by AddWorkspace().
tests/RustPlusBot.Features.Workspace.Tests/Specs/ServerChannelSpecTests.cs Adds regression tests pinning the per-server channel set and relative ordering including ServerPlayerEvents.
tests/RustPlusBot.Features.Workspace.Tests/Locating/PlayerEventChannelLocatorTests.cs Validates the new locator resolves playerevents (not events) from the store.
tests/RustPlusBot.Features.Players.Tests/PlayerEventRelayTests.cs Updates relay tests to substitute the new locator interface.
tests/RustPlusBot.Features.Players.Tests/PlayerEventRegistrationTests.cs Updates DI test to provide IPlayerEventChannelLocator for AddPlayers() resolution.
tests/RustPlusBot.Features.Players.Tests/Hosting/PlayersHostedServiceTests.cs Updates hosted-service test harness to use IPlayerEventChannelLocator.
src/RustPlusBot.Localization/Strings.resx Adds English channel name resource for channel.playerevents.name.
src/RustPlusBot.Localization/Strings.fr.resx Adds French channel name resource for channel.playerevents.name.
src/RustPlusBot.Features.Workspace/WorkspaceServiceCollectionExtensions.cs Registers IPlayerEventChannelLocatorPlayerEventChannelLocator as a singleton locator.
src/RustPlusBot.Features.Workspace/WorkspaceKeys.cs Adds the persisted channel key constant ServerPlayerEvents = "playerevents".
src/RustPlusBot.Features.Workspace/Specs/ServerWorkspaceSpecProvider.cs Inserts the new channel spec at order 5 and shifts subsequent channel orders.
src/RustPlusBot.Features.Workspace/Locating/PlayerEventChannelLocator.cs Adds a CachingChannelLocator-based locator for the playerevents key.
src/RustPlusBot.Features.Workspace/Locating/IPlayerEventChannelLocator.cs Adds the public locator interface consumed by other feature assemblies.
src/RustPlusBot.Features.Players/Relaying/PlayerEventRelay.cs Switches relay dependency from IEventChannelLocator to IPlayerEventChannelLocator and updates XML docs.
README.md Documents the new #player-events channel in the channel tour.
docs/superpowers/specs/2026-07-22-player-events-channel-design.md Adds design spec describing scope, approach, and data flow for the split.
docs/superpowers/plans/2026-07-22-player-events-channel.md Adds an implementation plan capturing steps, constraints, and verification.
docs/development/running-locally.md Updates local-running docs to mention auto-created #player-events behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HandyS11
HandyS11 merged commit c6ad400 into develop Jul 23, 2026
4 checks passed
@HandyS11
HandyS11 deleted the feat/player-events-channel branch July 23, 2026 16:45
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.

2 participants