Repository navigation
Add structured plugin command events - #5043
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a structured, host-routed plugin command dispatch path so plugin-declared chat commands are matched by the host, gated (mod-only), cooldown-managed per user, and delivered as a reserved chat.command event while preserving existing chat message delivery and the aggregated built-in !help response.
Changes:
- Introduces host-side command matching/dispatch (
chat.command) with alias support, moderator gating, and per-user cooldown tracking. - Extends the plugin wire types to include
CommandInfo,CommandEvent, andclientIdonHostChatMessage, updating the contract snapshot and related tests. - Updates pluginhost event flow so accepted chat messages still notify ordinary chat handlers and additionally trigger command dispatch.
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| services/plugins/shared_engine_test.go | Extends shared-engine tests to verify command registration and targeted command dispatch behavior. |
| services/plugins/plugin-contract.json | Updates the wire contract snapshot with new command/event types and clientId on chat messages. |
| services/plugins/manifest.go | Removes local CommandInfo and updates manifest commentary to reflect host-side command routing. |
| services/plugins/manager.go | Adds per-plugin cooldown state fields and clarifies command registration semantics during load. |
| services/plugins/hostfns.go | Defines CommandInfo, CommandEvent, and adds clientId to HostChatMessage for the plugin wire layer. |
| services/plugins/help.go | Centralizes default command prefix and !help/!commands alias handling. |
| services/plugins/events.go | Reserves and documents the new chat.command event type. |
| services/plugins/dispatcher_test.go | Ensures reserved event type coverage includes chat.command. |
| services/plugins/contract_test.go | Updates contract test messaging and adds an UPDATE_CONTRACT regeneration path. |
| services/plugins/commands.go | Implements command matching, gating, cooldown pruning, and targeted chat.command delivery. |
| services/plugins/commands_test.go | Adds unit tests for matching, duplicate dispatch, moderator gating, and cooldown behavior. |
| pluginhost/pluginhost.go | Updates help responder comment to reflect continued chat delivery plus command dispatch. |
| pluginhost/pluginevents.go | Runs command dispatch after notifying chat.message.received subscribers for accepted messages. |
Owncast Web Frontend
|
||||||||||||||||||||||||||||
| Project |
Owncast Web Frontend
|
| Branch Review |
gek/plugin-command-events
|
| Run status |
|
| Run duration | 05m 45s |
| Commit |
|
| Committer | Gabe Kangas |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
131
|
| View all changes introduced in this branch ↗︎ | |
3bf37e2 to
93c189d
Compare
|
The Windows Go job has failed twice in the existing |
93c189d to
03c125b
Compare
Plugin command tables now use the accepted chat message path for matching, arguments, moderator gates, and cooldowns.
chat.commandevent without adding a plugin permission.!helpand!commands.A matching plugin receives this internal payload:
{ "message": {"id": "m1", "body": "!up one two", "user": {"id": "u1"}}, "command": "uptime", "invokedAs": "up", "args": ["one", "two"], "argString": "one two" }The paired SDK change is owncast/plugin-sdk#3.
Testing included the plugin and pluginhost Go suites, direct matching and cooldown coverage, the host-runtime tests, and the complete JavaScript and Python mod-commands scenarios.
Required checklist
Do not remove this section. These checkboxes are required and validated.