feat(matrix): add multi-room support with per-room config#18
Open
navsteruk wants to merge 1 commit intoopenagen:masterfrom
Open
feat(matrix): add multi-room support with per-room config#18navsteruk wants to merge 1 commit intoopenagen:masterfrom
navsteruk wants to merge 1 commit intoopenagen:masterfrom
Conversation
Add support for monitoring multiple Matrix rooms from a single channel
instance, aligned with OpenClaw's per-room configuration approach.
Changes:
- Add MatrixRoomConfig struct with enabled and require_mention fields
- Add optional rooms HashMap to MatrixConfig (backward compatible)
- Activate the dormant multi-room filter in the listen() event handler
- Add per-room mention detection using bot user ID and display name
- Resolve bot display name on startup for mention matching
- Fix channel name lookup to strip room ID suffix (was preventing
replies from being sent back to Matrix)
Config example:
[channels_config.matrix.rooms]
"!room1:matrix.org" = { enabled = true, require_mention = false }
"!room2:matrix.org" = { enabled = true, require_mention = true }
When rooms is absent, behavior is identical to before (single room_id).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Changes
Config example
When
roomsis absent, behavior is identical to the current single-room mode.Bug fix included
The
msg.channelfield includes the room ID (e.g.matrix:!room:server) butchannels_by_nameis keyed by just the channel name (matrix). This causedtarget_channelto beNone, silently dropping all replies. Fixed by stripping the room suffix before lookup.Test plan
roomsfield)require_mentionsettings🤖 Generated with Claude Code