Skip to content

Commit

Permalink
Fix twitch animated emotes not detected (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nogesma authored Apr 25, 2024
1 parent 90bd67d commit f963c51
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/emotes/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mod twitch {
id: String,
name: String,
images: Image,
format: Vec<String>,
}

#[derive(Deserialize)]
Expand Down Expand Up @@ -61,7 +62,18 @@ mod twitch {
Ok(channel_emotes
.into_iter()
.chain(global_emotes)
.map(|emote| (emote.name, (emote.id, emote.images.url_1x, false)))
.map(|emote| {
let (id, url) = if emote.format.contains(&String::from("animated")) {
(
emote.id + "-animated",
emote.images.url_1x.replace("/static/", "/animated/"),
)
} else {
(emote.id, emote.images.url_1x)
};

(emote.name, (id, url, false))
})
.collect())
}
}
Expand Down

0 comments on commit f963c51

Please sign in to comment.