feat: direct chats need no mention; plain-text display name mentions #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/direct-chats"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
m.textmessage from the other member counts as addressed to the bot. Commands (!route,!route set fj <url>,!help,!name) work without a mention; other text is dispatched by the named-route rules (first word = route name, elsedefault). A leading mention/pill is still stripped.runner::room_contextsreads each joined room's joined members from the SDK state store at every sync (after the sync's state is applied);is_direct_chat= 2 members, one of them the bot. A room that gains a third member stops being direct from that sync on.m.direct/is_directis not used.defaultonly, change commands ignored). The bot's own messages never qualify (sender check), and unmentioned notices in a direct chat don't either, so bots cannot loop. Replies to reports work as before.@<display name>as plain text (word-bounded, case-sensitive;@hl-n8nXdoes not match) counts as a mention and is stripped like the localpart. Uses the bot's room member display name, else the global name read at startup and updated after a successful!name.!helpnotes that direct chats need no mention.Tests
cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test --all-features(112 passed). New tests cover: direct chat without mention (text + command), group room without mention, 3 members not direct, bot's own message/notice in a direct chat, unmentioned notices, non-command user todefault, per-room routes without fallback, replies in a direct chat, display-name match/no match on prefix/case/stripping/rename.Not tested: live against a homeserver (member reads from the SDK store are not unit-tested).
🤖 Generated with Claude Code