Dispatch chat commands in the dev server - #5
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the owncast-plugin-serve dev server to more closely match production Owncast behavior by dispatching declared chat commands for accepted dev-chat messages, enabling local testing of manifest commands without running a full Owncast instance.
Changes:
- Dispatch
DispatchCommandsafter firingchat.message.receivedfor accepted/\_dev/chatmessages. - Update
/_dev/chatdocumentation in the dev server header comment to reflect the new command-dispatch behavior. - Document the object form of
user(including moderator scopes) in both JS and Pythonmod-commandsexample READMEs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| host-runtime/cmd/owncast-plugin-serve/main.go | Dispatch chat commands in the dev server after the accepted-message notification. |
| examples/python/mod-commands/README.md | Document user object form to grant MODERATOR scope for local command gating tests. |
| examples/js/mod-commands/README.md | Document user object form to grant MODERATOR scope for local command gating tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gabek
force-pushed
the
fix/serve-dispatch-commands
branch
from
July 30, 2026 23:08
b83d6d7 to
beea986
Compare
The dev server ran the filter chain and fired chat.message.received, but never matched the message against the plugin's declared commands. A declarative commands table therefore never ran locally, and the curl both mod-commands READMEs document produced no reply. Owncast does that matching host-side right after notifying subscribers of the same accepted message, so the dev server has to make the call itself. It sits behind the filter-drop early return, so a dropped message still runs no commands. Also document the object form of user in both mod-commands READMEs, which is how you drive a moderator-gated command from curl.
gabek
force-pushed
the
fix/serve-dispatch-commands
branch
from
July 30, 2026 23:12
beea986 to
2989a4f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
POST /_dev/chatran the filter chain and firedchat.message.received, but never matched the message against the plugin's declared commands. A declarativecommandstable therefore never ran locally, and the curl both mod-commands READMEs already document produced no reply at all.DispatchCommandsafter the chat notification for the same accepted message, which is the order Owncast uses. It sits behind the filter-drop early return, so a dropped message still runs no commands.userin both mod-commands READMEs. A bare string is an ordinary viewer, and an object is how you grant the MODERATOR scope that?announceneeds.One call covers prefix matching, aliases, case insensitivity, moderator gating and cooldowns, because all of that lives in the runtime already.
Driving the prebuilt mod-commands example, server log on the left of the arrow being what
mainproduced:The audit line is the plugin's own
onChatMessagehandler, which still fires for every message, so ordinary chat delivery is unchanged. The Python mod-commands example produces a byte-identical log.I also checked a throwaway plugin that declares both a filter and a command: a message the filter drops answers
{"allowed":false}and runs no command, so the placement behind the early return is right.Copilot caught one mismatch in the first version: a filter-modified user reached
onChatMessage, but moderator gating still saw the original user. A focused before and after probe rewrote an ordinary viewer toMODERATORand rewrote the body to a moderator-only command. Before the fix,onChatMessagesawMODERATORbut the command was rejected. After the fix, the command runs.No tests added.
cmd/owncast-plugin-servehas no harness for spinning up the server, so the evidence is the before and after run against the real examples and the focused filter rewrite probe. PR #4 is merged, and this branch is rebased directly onto the resultingmaincommit.