Skip to content

Add Chat Shortcuts add-on - #397

Open
abodnar wants to merge 8 commits into
FrankerFaceZ:masterfrom
abodnar:chat-shortcuts
Open

abodnar wants to merge 8 commits into
FrankerFaceZ:masterfrom
abodnar:chat-shortcuts

Conversation

@abodnar

@abodnar abodnar commented Oct 15, 2026

Copy link
Copy Markdown

Adds Chat Shortcuts: user-defined shortcuts like ;gg that expand into text in the chat input. Text is only ever placed in the input — nothing is sent automatically.

Features

  • Inline expansion — ;name + Space/Tab expands in place; Backspace immediately after undoes it.
  • Autocomplete — typing the prefix shows matching shortcuts in Twitch's suggestion menu, with emote-rendered previews.
  • Settings editor (Add-Ons > Chat Shortcuts) — row editor with inline validation, live previews, and emote autocomplete that follows the user's FFZ tab-completion settings (matching type, limit, favorites/prefix priority, without-colon, show-source).
  • Prefix is configurable (default ;).

Notes for reviewers

  • FFZ internals: uses the chat input module's buildTwitchCache / buildFFZCache and the ffz_twitch_cache / ffz_ffz_cache / _ffz_* fields on the emote provider, mirroring inline-tab-completion's approach. All hooks are wrapped in try/catch and fall back to default behavior.
  • Custom Vue component: there is no built-in name → text list editor, so the add-on ships shortcut-list-editor.vue (same pattern as CustomCmds). Shortcuts are stored directly on the settings provider (global, not per-profile).
  • Known limitation: with Twitch's Slate editor FFZ can't set the caret, so a mid-message expansion may move the caret to the end.
  • Tests: pure logic (matcher.js, preview.js, emotes.js) has node:test coverage in *.test.js; these aren't webpack entries. Happy to drop them if you'd rather not have test files in the repo.
  • Developed with AI assistance (Claude); I've reviewed and tested it in Safari.

🤖 Generated with Claude Code

Adam Bodnar and others added 8 commits October 14, 2026 21:00
Shortcuts like ;gg expand into the chat input on Space/Tab, or via
the emote autocomplete menu. Pure matcher with node:test coverage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The editor writes the list directly to the provider, but the add-on read it
via settings.get(), which only sees profile-prefixed keys, so the list was
always empty and nothing expanded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Previews resolve emote names against the Twitch and FFZ/BTTV/7TV
tab-completion caches FFZ keeps on the emote provider and render them
as inline images. Pure buildPreview() with node:test coverage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- validateShortcuts() flags rows parseShortcuts() would skip, plus names
  that include the prefix; shown inline in the editor.
- Editor rows show the emote-rendered preview using the open chat's emotes.
- Expansion logic moved to pure expandAt(); Backspace immediately after an
  expansion restores the original text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Editor text fields autocomplete emotes with ':' (or Tab without colon),
  following the user's FFZ tab-completion settings.
- With no chat open, the editor uses the user's global/personal FFZ, BTTV
  and 7TV emote sets.
- Pure emote matching (emotes.js) mirroring FFZ's rules, with tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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