mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-28 05:28:30 +00:00
Fix duplicate turbo/prime emotes in self-sent messages, and other future cases where two emotes have the same indices.
This commit is contained in:
parent
bb26260e23
commit
2c28afc6a6
1 changed files with 8 additions and 1 deletions
|
@ -306,6 +306,7 @@ export const CheerEmotes = {
|
||||||
if ( ! tokens || ! tokens.length || ! msg.bits )
|
if ( ! tokens || ! tokens.length || ! msg.bits )
|
||||||
return tokens;
|
return tokens;
|
||||||
|
|
||||||
|
// TODO: Store the room onto the chat message so we don't need to look this up.
|
||||||
const SiteChat = this.resolve('site.chat'),
|
const SiteChat = this.resolve('site.chat'),
|
||||||
chat = SiteChat && SiteChat.currentChat,
|
chat = SiteChat && SiteChat.currentChat,
|
||||||
bitsConfig = chat && chat.props.bitsConfig;
|
bitsConfig = chat && chat.props.bitsConfig;
|
||||||
|
@ -634,7 +635,7 @@ export const TwitchEmotes = {
|
||||||
if ( ! e_length )
|
if ( ! e_length )
|
||||||
return tokens;
|
return tokens;
|
||||||
|
|
||||||
emotes.sort((a,b) => a[1] - b[1]);
|
emotes.sort((a,b) => a[1] !== b[1] ? a[1] - b[1] : b[0] - a[0]);
|
||||||
|
|
||||||
let idx = 0,
|
let idx = 0,
|
||||||
eix = 0;
|
eix = 0;
|
||||||
|
@ -675,6 +676,12 @@ export const TwitchEmotes = {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this emote starts before the current index, skip it.
|
||||||
|
if ( e_start < idx ) {
|
||||||
|
eix++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// If there's text at the beginning of the token that
|
// If there's text at the beginning of the token that
|
||||||
// isn't part of this emote, output it.
|
// isn't part of this emote, output it.
|
||||||
if ( e_start > idx )
|
if ( e_start > idx )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue