Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emote Side Panel #212

Merged
merged 2 commits into from
Mar 31, 2024
Merged

Emote Side Panel #212

merged 2 commits into from
Mar 31, 2024

Conversation

amartini
Copy link
Contributor

@amartini amartini commented Mar 31, 2024

New Add-On: Emote Side Panel
Based this on the Emote Less Chat add-on by EchtkPvL, but instead of only deleting the emote chat lines, I display the emotes on a side panel located right side to the chat. The emotes are removed after a configurable timeout.
If more than one chat contains the same emote, they are gathered and a counter is displayed on top of it.
There's also a setting to capture emotes from all chat lines, and an option to only capture emotes and do not remove the chat line.
With this, fast rolling chats are much more readable.

Copy link
Collaborator

@SirStendec SirStendec left a comment

Choose a reason for hiding this comment

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

Couple notes for you, but the main thing is you need to set enabled to true in the manifest.

class EmoteSidePanel extends Addon {

getContainer() {
return document.querySelector("[aria-label='Chat messages']");
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can just use .chat-list--default to get this element. Using an aria-label to pick an element is a bad practice because it's a localized string. This means it'll only work for users with Twitch in English.

if (emoteOnly && !keepEmoteMessages) msg.ffz_removed = true;

// Add emotes to the list
for (const token of tokens) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Messages can be re-tokenized for various reasons, which can cause this code to run again. Given the design of your add-on, you might want to put a flag on the message object as a sort of "we already processed this" so you don't re-add emotes from old chat messages you already handled before. Just like if ( msg.esp_handled ) return tokens; and msg.esp_handled = true;

@@ -0,0 +1,13 @@
{
"enabled": false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

You need to set "enabled" to true, otherwise your add-on won't be built and published.

@amartini
Copy link
Contributor Author

Thanks for the review! Made all suggested changes. For me, the chat panel doesn't have this class, but .chat-list--other, so i'm selecting both.

@amartini amartini requested a review from SirStendec March 31, 2024 22:17
@SirStendec SirStendec merged commit 694423d into FrankerFaceZ:master Mar 31, 2024
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