From f02988b6575378f7302ea21e2a2b20199b095156 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Tue, 31 Dec 2019 21:21:53 +0100 Subject: [PATCH] Correct "Emote Link" for BTTV Global and Channel emotes --- src/providers/bttv/BttvEmotes.cpp | 37 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/providers/bttv/BttvEmotes.cpp b/src/providers/bttv/BttvEmotes.cpp index 3b3c0d234..36481dd7c 100644 --- a/src/providers/bttv/BttvEmotes.cpp +++ b/src/providers/bttv/BttvEmotes.cpp @@ -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 + "
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 + "
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 + "
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 + "
Channel BetterTTV Emote"}, + Url{emoteLinkFormat.arg(id.string)}, + }); emotes[name] = cachedOrMake(std::move(emote), id); }