Skip to content

Commit

Permalink
Merge pull request #94 from HiDeoo/hd-duplicate-emote-fix
Browse files Browse the repository at this point in the history
Fix a rendering issue with some third-party emotes
  • Loading branch information
HiDeoo authored Mar 19, 2022
2 parents c3f6b59 + 6b30c89 commit 9c69372
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.17.2

### 🐛 Bug Fix

- Fix a rendering issue with some third-party emotes.

# 1.17.1

### 🐛 Bug Fix
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yata",
"version": "1.17.1",
"version": "1.17.2",
"description": "Twitch chat client",
"author": "HiDeoo",
"license": "MIT",
Expand Down
8 changes: 8 additions & 0 deletions src/libs/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,16 @@ export default class Message implements Serializable<SerializedMessage> {
* @param emotes - The message emotes.
*/
private parseEmotes(parsedMessage: string[], emotes: Emotes) {
const parsedRanges = new Set<string>()

_.forEach(emotes, (ranges, id) => {
const [providerPrefix, emoteId] = id.split('-')

_.forEach(ranges, (range) => {
if (parsedRanges.has(range)) {
return
}

const strIndexes = range.split('-')
const indexes = [parseInt(strIndexes[0], 10), parseInt(strIndexes[1], 10)]
const name = []
Expand All @@ -324,6 +330,8 @@ export default class Message implements Serializable<SerializedMessage> {

if (!_.isNil(provider)) {
parsedMessage[indexes[0]] = provider.getEmoteTag(isTwitchEmote ? id : emoteId, emoteName)

parsedRanges.add(range)
}
})
})
Expand Down

0 comments on commit 9c69372

Please sign in to comment.