Skip to content

Add emote aliases for tab completion and chat#7910

Open
deboralbarros wants to merge 7 commits into
night:masterfrom
deboralbarros:master
Open

Add emote aliases for tab completion and chat#7910
deboralbarros wants to merge 7 commits into
night:masterfrom
deboralbarros:master

Conversation

@deboralbarros

@deboralbarros deboralbarros commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Users can create personal aliases (e.g. lolKEKW) that map any typed shortcut to any emote code
  • Aliases take priority over regular emotes in tab completion (pressing Tab)
  • Aliases are also substituted on message send (pressing Enter), so typing lol directly and hitting Enter sends KEKW
  • Alias management UI added under Settings → Tab Completion → Emote Aliases, following the same table pattern as Highlight/Blacklist Keywords
  • All new strings translated across all 17 supported locales

How it works

Storage: aliases are persisted in localStorage as { uuid: { id, alias, targetCode } } under SettingIds.EMOTE_ALIASES, following the same pattern as highlight keywords.

Tab completion (chat_tab_completion): getAliasMatches() checks user aliases before the regular emote list, so matching aliases always surface first.

Message send (send_message): replaceEmoteAliases() is registered in the methodList pipeline and substitutes each word in the message against the alias map before dispatch — the same mechanism used by the emoji substitution module.

Test plan

  • Create an alias (lolKEKW) in Settings → Tab Completion → Emote Aliases
  • Type lol in chat and press Tab — verify KEKW appears as the first suggestion
  • Type lol in chat and press Enter directly — verify the message is sent as KEKW
  • Verify aliases with no matching emote still insert the target code string
  • Verify deleting an alias removes it from both tab completion and send behavior
  • Verify the Settings page back button returns to the main Settings page

Preview

Demo of the feature in action.

Gravando.2026-04-24.120742.1.mp4

@night night left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for putting this together. Really clean implementation, and following the existing SettingKeywords pattern made it easy to read.

A few things before we can merge:

  1. Please rebase onto master. We just landed a Mantine 9 + React 19 upgrade (#7947), so this branch is now behind. The change should still merge cleanly given how closely it tracks the existing settings patterns.

  2. Drop the non-English locale changes. Only the English strings (the defaultMessage values in source) need to be edited. Every other locale is managed via Crowdin and gets imported automatically, so hand-edited translations there will get overwritten on the next sync. Removing the cs-CZ.json through uk-UA.json edits will shrink the diff substantially.

  3. Naming/framing. What you've built isn't really an emote alias system, it's a general text replacement feature (the "target" can be any string, with no validation that it's an emote, and the substitution runs unconditionally on send). That's actually fine, and probably more useful than a strict emote-only version, but the naming ("Emote Aliases", EMOTE_ALIASES, targetCode) overpromises. Could you rename around "Text Replacements" or "Substitutions" or similar? SettingIds.TEXT_REPLACEMENTS, page name, settings copy, etc. Happy to bikeshed the exact term if you have a preference.

Comment thread src/modules/send_message/index.js Outdated
Users can define personal text replacements (e.g. "pog" → "stormW30Pog")
that take priority during tab completion and are substituted on message send.
A management page is added under Settings → Tab Completion → Text Replacements.
Comment thread src/modules/settings/components/SettingTextReplacements.jsx Outdated
Comment thread src/modules/chat_tab_completion/index.js
Comment thread src/modules/settings/components/SettingsModal.jsx Outdated
Comment thread src/modules/send_message/index.js
Comment thread src/modules/chat_tab_completion/index.js
Comment thread src/modules/settings/components/SettingTextReplacements.module.css
Comment thread src/modules/settings/settings/twitch/TabCompletion.jsx Outdated
deboralbarros and others added 2 commits May 28, 2026 21:22
- Strip internal whitespace from trigger on blur so multi-word triggers are not silently unreachable
- Deduplicate tab completion suggestions by filtering emote/user lists against alias replacements
- Move Text Replacements entry point from Tab Completion group to Chat group
- Replace nested ternary in SettingsModal title with a page title lookup map
- Add comment explaining applyTextReplacements must remain first in the send pipeline
- Reduce CSS duplication in SettingTextReplacements by composing shared styles from SettingKeywords

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@deboralbarros
deboralbarros requested a review from night May 29, 2026 02:06
deboralbarros and others added 4 commits July 3, 2026 21:58
…acements

# Conflicts:
#	src/constants.js
#	src/modules/send_message/index.js
#	src/modules/settings/components/SettingsModal.jsx
#	src/modules/settings/components/SideNavigation.jsx
#	src/modules/settings/settings/twitch/Chat.jsx
Updates imports to the @ alias style and fixes prettier formatting
introduced by the upstream merge (webpack -> vite, relative -> alias imports).
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