Correct "Emote Link" for BTTV Global and Channel emotes

This commit is contained in:
Rasmus Karlsson 2019-12-31 21:21:53 +01:00
parent 845c8fa638
commit f02988b657

View file

@ -13,6 +13,9 @@
namespace chatterino {
namespace {
QString emoteLinkFormat("https://betterttv.com/emotes/%1");
Url getEmoteLink(QString urlTemplate, const EmoteId &id,
const QString &emoteScale)
{
@ -47,13 +50,14 @@ namespace {
auto name =
EmoteName{jsonEmote.toObject().value("code").toString()};
auto emote = Emote(
{name,
ImageSet{Image::fromUrl(getEmoteLinkV3(id, "1x"), 1),
Image::fromUrl(getEmoteLinkV3(id, "2x"), 0.5),
Image::fromUrl(getEmoteLinkV3(id, "3x"), 0.25)},
Tooltip{name.string + "<br />Global BetterTTV Emote"},
Url{"https://manage.betterttv.net/emotes/" + id.string}});
auto emote = Emote({
name,
ImageSet{Image::fromUrl(getEmoteLinkV3(id, "1x"), 1),
Image::fromUrl(getEmoteLinkV3(id, "2x"), 0.5),
Image::fromUrl(getEmoteLinkV3(id, "3x"), 0.25)},
Tooltip{name.string + "<br />Global BetterTTV Emote"},
Url{emoteLinkFormat.arg(id.string)},
});
emotes[name] =
cachedOrMakeEmotePtr(std::move(emote), currentEmotes);
@ -75,15 +79,16 @@ namespace {
auto name = EmoteName{jsonEmote.value("code").toString()};
// emoteObject.value("imageType").toString();
auto emote = Emote(
{name,
ImageSet{
Image::fromUrl(getEmoteLinkV3(id, "1x"), 1),
Image::fromUrl(getEmoteLinkV3(id, "2x"), 0.5),
Image::fromUrl(getEmoteLinkV3(id, "3x"), 0.25),
},
Tooltip{name.string + "<br />Channel BetterTTV Emote"},
Url{"https://manage.betterttv.net/emotes/" + id.string}});
auto emote = Emote({
name,
ImageSet{
Image::fromUrl(getEmoteLinkV3(id, "1x"), 1),
Image::fromUrl(getEmoteLinkV3(id, "2x"), 0.5),
Image::fromUrl(getEmoteLinkV3(id, "3x"), 0.25),
},
Tooltip{name.string + "<br />Channel BetterTTV Emote"},
Url{emoteLinkFormat.arg(id.string)},
});
emotes[name] = cachedOrMake(std::move(emote), id);
}