feat(messaging): add role replacements to generic replacements#77
Merged
Conversation
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.
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
@RoleNamein embeds now resolves to a mention for the guild role of that exact name (the@everyonerole is excluded)@role:RoleNameform added to unambiguously reference a role whose name collides with a reserved placeholder (e.g. a role called "server"); reserved placeholders andcustom_replacementsalways take prioritygithub-pages-site/docs/messaging/generic-replacements.md, including a note that mentions placed in embeds never trigger ping notifications regardless of role mentionability settingsTest plan
TestUtils(src/tests.py) covering bare match, no match,@everyoneexclusion, reserved-placeholder precedence, explicit@role:syntax, and longest-name-first orderingpython3 ./src/tests.py --run-all): 48/48 passing@date/@dateshort/@datelongstill resolve correctly after the ordering fix🤖 Generated with Claude Code