Skip to content

fix: handle !leader with no space before custom emoji#59

Merged
zippy1981 merged 9 commits into
mainfrom
fix/leader-emoji-no-space
May 12, 2026
Merged

fix: handle !leader with no space before custom emoji#59
zippy1981 merged 9 commits into
mainfrom
fix/leader-emoji-no-space

Conversation

@davelindsay84

Copy link
Copy Markdown
Collaborator

Summary

  • parseLeaderCommand sliced '!leader '.length (8 chars), which consumed the leading < of a custom emoji when typed without a space — e.g. !leader<:umami:id> produced body :umami:id> instead of <:umami:id>. The regex didn't match, so key and display were wrong, and the Easter-egg zero-results message echoed the broken entity literally.
  • Fix: slice by '!leader'.length (7 chars) and let the existing .trim() handle any leading space.

Test plan

  • Added parseLeaderCommand('!leader<:kirby:123456789>') test — now returns correct key and display
  • Existing tests all pass

🤖 Generated with Claude Code

David Lindsay and others added 9 commits May 2, 2026 09:53
Discord.js Collection iterates as [id, Message] pairs, not bare Messages.
Passing .values() gives replaceFirstMessage the Message objects it expects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ing, proxyAuthors leak

- config.js: trim whitespace from SearchPhrasesToBlock entries so that
  'bad, word' in the env var does not create a ' word' entry that silently
  bypasses the block
- replacer.js: apply normalizeUnicode to the replacement text before the
  blocked-phrase check, closing the curly-quote bypass
- scoring.js: guard parseScoreLine against bare '++' / '--' lines that
  would insert an empty-string phrase into the DB
- reactions.js: cap proxyAuthors Map at 1000 entries (FIFO eviction) to
  prevent unbounded growth over long uptime

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Output is now a single line: **👍 (30d)** 1. <@id1> 3, 2. <@id2> 2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lents

Adds U+201B and U+02BC to the Unicode normalizer so that modifier-letter
apostrophes (and other device-specific single-quote substitutions) match
regular apostrophes in searches and scored phrases. Applies normalizeUnicode
to phrase storage and lookup in scoring so that smart apostrophes and em
dashes typed in scored phrases are interchangeable across devices.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Slicing by '!leader ' (with space) consumed the leading '<' of a
custom emoji when typed without a space, producing ':name:id>' as the
body instead of '<:name:id>'. The regex didn't match, key and display
were wrong, and the Easter-egg zero-results message echoed the broken
entity literally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Slicing by '!leader ' (with space) consumed the leading '<' of a
custom emoji when typed without a space, producing ':name:id>' as the
body instead of '<:name:id>'. The regex didn't match, key and display
were wrong, and the Easter-egg zero-results message echoed the broken
entity literally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread reactions.js
// of the command issuer.
// Capped at 1000 entries (FIFO) — the oldest entry is evicted when the cap is
// hit, since stale proxy mappings for long-past messages are never useful.
const PROXY_AUTHORS_MAX = 1000;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this configurable

@zippy1981 zippy1981 merged commit 56630ed into main May 12, 2026
1 check passed
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.

2 participants