Skip to content

feat(messaging): add role replacements to generic replacements#77

Merged
cypress-exe merged 2 commits into
mainfrom
feature/role-replacements
Jul 20, 2026
Merged

feat(messaging): add role replacements to generic replacements#77
cypress-exe merged 2 commits into
mainfrom
feature/role-replacements

Conversation

@cypress-exe

Copy link
Copy Markdown
Owner

Summary

  • @RoleName in embeds now resolves to a mention for the guild role of that exact name (the @everyone role is excluded)
  • Explicit @role:RoleName form added to unambiguously reference a role whose name collides with a reserved placeholder (e.g. a role called "server"); reserved placeholders and custom_replacements always take priority
  • Fixed the final placeholder-replacement pass to sort by key length descending instead of relying on insertion order, so an arbitrary shorter role name (e.g. "Mod") can't corrupt a longer one (e.g. "Moderator") mid-replace
  • Documented in github-pages-site/docs/messaging/generic-replacements.md, including a note that mentions placed in embeds never trigger ping notifications regardless of role mentionability settings

Test plan

  • Added 6 unit tests in TestUtils (src/tests.py) covering bare match, no match, @everyone exclusion, reserved-placeholder precedence, explicit @role: syntax, and longest-name-first ordering
  • Ran full local suite (python3 ./src/tests.py --run-all): 48/48 passing
  • Manually verified @date/@dateshort/@datelong still resolve correctly after the ordering fix

🤖 Generated with Claude Code

cypress-exe and others added 2 commits July 19, 2026 23:30
Bare @rolename resolves to a mention for the guild role of that exact
name, and the explicit @ROLE:RoleName form disambiguates when a role's
name collides with a reserved placeholder like @server. Reserved
placeholders and custom_replacements always win over a same-named role,
and the @everyone role is never matched this way.

Also fixes the final replacement pass to sort by key length descending
rather than relying on insertion order, since arbitrary role names
(unlike the small fixed set of date placeholders) can't be ordered to
avoid one name's prefix corrupting a longer one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude wrote documentation for its new member-mention replacements, but
I didn't like some of its wording/formatting. This commit just refines
it.
@cypress-exe
cypress-exe merged commit 5e1bd00 into main Jul 20, 2026
7 checks passed
@cypress-exe
cypress-exe deleted the feature/role-replacements branch July 20, 2026 05:40
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.

1 participant