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

fix(twitch): support lowercase cheers #981

Merged
merged 4 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-nightly.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
**The changes listed here are not assigned to an official release**.

- Reinstated animated avatars
- Fixed an issue where lowercase cheers were displayed as text
- Added an option to hide the community challenge contributions in the chat
- Fixed extension not working on twitch for some users (React 18 support)
- Fixed an issue where chat messages (like announcements) did not use the channel accent color
Expand Down
9 changes: 8 additions & 1 deletion src/site/twitch.tv/modules/chat-vod/ChatVod.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function createMessageComponentRef(data: CommentData) {
const e = tok.content as Twitch.ChatMessage.EmotePart["content"];
if (!e.alt) continue;
msg.nativeEmotes[e.alt + (e.cheerAmount ?? "")] = {
const nativeEmote: SevenTV.ActiveEmote = {
id: e.emoteID ?? "",
name: e.alt,
flags: 0,
Expand All @@ -238,7 +238,14 @@ function createMessageComponentRef(data: CommentData) {
token: e.alt,
} as Partial<Twitch.TwitchEmote>),
};
const emoteName = e.alt + (e.cheerAmount ?? "");
msg.nativeEmotes[emoteName] = nativeEmote;
// if it's a cheer we also want to support it's lowercase variant (e.g. Cheer1 & cheer1)
if (e.cheerAmount) {
msg.nativeEmotes[emoteName.toLowerCase()] = nativeEmote;
}
msg.body += e.alt;
break;
}
Expand Down
10 changes: 9 additions & 1 deletion src/site/twitch.tv/modules/chat/ChatList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function onChatMessage(msg: ChatMessage, msgData: Twitch.AnyMessage, shouldRende
// skip over emotes patched in by FFZ and BTTV
if (e.emoteID?.startsWith("__FFZ__") || e.emoteID?.startsWith("__BTTV__")) continue;

msg.nativeEmotes[e.alt + (e.cheerAmount ?? "")] = {
const nativeEmote: SevenTV.ActiveEmote = {
id: e.emoteID ?? "",
name: e.alt,
flags: 0,
Expand All @@ -266,6 +266,14 @@ function onChatMessage(msg: ChatMessage, msgData: Twitch.AnyMessage, shouldRende
token: e.alt,
} as Partial<Twitch.TwitchEmote>),
};
const emoteName = e.alt + (e.cheerAmount ?? "");

msg.nativeEmotes[emoteName] = nativeEmote;

// if it's a cheer we also want to support it's lowercase variant (e.g. Cheer1 & cheer1)
if (e.cheerAmount) {
msg.nativeEmotes[emoteName.toLowerCase()] = nativeEmote;
}
break;
}
// replace flagged segments
Expand Down
Loading