feat: Add 7TV Emotes and Badges (#4002)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2022-10-16 13:22:17 +02:00
committed by GitHub
parent e8fd49aadb
commit 3e41b84ed7
29 changed files with 780 additions and 7 deletions
+21
View File
@@ -359,6 +359,12 @@ void EmotePopup::loadChannel(ChannelPtr channel)
addEmotes(*globalChannel, *getApp()->twitch->getFfzEmotes().emotes(),
"FrankerFaceZ", MessageElementFlag::FfzEmote);
}
if (Settings::instance().enableSevenTVGlobalEmotes)
{
addEmotes(*globalChannel,
*getApp()->twitch->getSeventvEmotes().globalEmotes(), "7TV",
MessageElementFlag::SevenTVEmote);
}
// channel
if (Settings::instance().enableBTTVChannelEmotes)
@@ -371,6 +377,11 @@ void EmotePopup::loadChannel(ChannelPtr channel)
addEmotes(*channelChannel, *this->twitchChannel_->ffzEmotes(),
"FrankerFaceZ", MessageElementFlag::FfzEmote);
}
if (Settings::instance().enableSevenTVChannelEmotes)
{
addEmotes(*channelChannel, *this->twitchChannel_->seventvEmotes(),
"7TV", MessageElementFlag::SevenTVEmote);
}
this->globalEmotesView_->setChannel(globalChannel);
this->subEmotesView_->setChannel(subChannel);
@@ -429,6 +440,8 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
searchText, getApp()->twitch->getBttvEmotes().emotes());
auto ffzGlobalEmotes = this->filterEmoteMap(
searchText, getApp()->twitch->getFfzEmotes().emotes());
auto *seventvGlobalEmotes = this->filterEmoteMap(
searchText, getApp()->twitch->getSeventvEmotes().globalEmotes());
// twitch
addEmoteSets(twitchGlobalEmotes, *searchChannel, *searchChannel,
@@ -451,6 +464,9 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
this->filterEmoteMap(searchText, this->twitchChannel_->bttvEmotes());
auto ffzChannelEmotes =
this->filterEmoteMap(searchText, this->twitchChannel_->ffzEmotes());
auto *seventvChannelEmotes =
this->filterEmoteMap(searchText, this->twitchChannel_->seventvEmotes());
// channel
if (bttvChannelEmotes->size() > 0)
addEmotes(*searchChannel, *bttvChannelEmotes, "BetterTTV (Channel)",
@@ -458,6 +474,11 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
if (ffzChannelEmotes->size() > 0)
addEmotes(*searchChannel, *ffzChannelEmotes, "FrankerFaceZ (Channel)",
MessageElementFlag::FfzEmote);
if (!seventvChannelEmotes->empty())
{
addEmotes(*searchChannel, *seventvChannelEmotes, "SevenTV (Channel)",
MessageElementFlag::SevenTVEmote);
}
}
void EmotePopup::filterEmotes(const QString &searchText)
+4
View File
@@ -120,6 +120,10 @@ namespace {
{
addPageLink("FFZ");
}
else if (creatorFlags.has(MessageElementFlag::SevenTVEmote))
{
addPageLink("7TV");
}
}
// Current function: https://www.desmos.com/calculator/vdyamchjwh
+21
View File
@@ -5,6 +5,8 @@
#include "common/Version.hpp"
#include "controllers/hotkeys/HotkeyCategory.hpp"
#include "controllers/hotkeys/HotkeyController.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "singletons/Fonts.hpp"
#include "singletons/NativeMessaging.hpp"
#include "singletons/Paths.hpp"
@@ -340,6 +342,22 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCheckbox("Remove spaces between emotes",
s.removeSpacesBetweenEmotes);
layout.addCheckbox("Show unlisted 7TV emotes", s.showUnlistedSevenTVEmotes);
s.showUnlistedSevenTVEmotes.connect(
[]() {
getApp()->twitch->forEachChannelAndSpecialChannels(
[](const auto &c) {
if (c->isTwitchChannel())
{
auto *channel = dynamic_cast<TwitchChannel *>(c.get());
if (channel != nullptr)
{
channel->refreshSevenTVChannelEmotes(false);
}
}
});
},
false);
layout.addDropdown<int>(
"Show info on hover", {"Don't show", "Always show", "Hold shift"},
s.emotesTooltipPreview,
@@ -362,6 +380,8 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCheckbox("Show BTTV channel emotes", s.enableBTTVChannelEmotes);
layout.addCheckbox("Show FFZ global emotes", s.enableFFZGlobalEmotes);
layout.addCheckbox("Show FFZ channel emotes", s.enableFFZChannelEmotes);
layout.addCheckbox("Show 7TV global emotes", s.enableSevenTVGlobalEmotes);
layout.addCheckbox("Show 7TV channel emotes", s.enableSevenTVChannelEmotes);
layout.addTitle("Streamer Mode");
layout.addDescription(
@@ -631,6 +651,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCheckbox("Chatterino", s.showBadgesChatterino);
layout.addCheckbox("FrankerFaceZ (Bot, FFZ Supporter, FFZ Developer)",
s.showBadgesFfz);
layout.addCheckbox("7TV", s.showBadgesSevenTV);
layout.addSeperator();
layout.addCheckbox("Use custom FrankerFaceZ moderator badges",
s.useCustomFfzModeratorBadges);
+10 -1
View File
@@ -5,6 +5,7 @@
#include "messages/Emote.hpp"
#include "providers/bttv/BttvEmotes.hpp"
#include "providers/ffz/FfzEmotes.hpp"
#include "providers/seventv/SeventvEmotes.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "singletons/Emotes.hpp"
@@ -99,17 +100,25 @@ void InputCompletionPopup::updateEmotes(const QString &text, ChannelPtr channel)
if (tc)
{
// TODO extract "Channel BetterTTV" text into a #define.
// TODO extract "Channel {BetterTTV,7TV,FrankerFaceZ}" text into a #define.
if (auto bttv = tc->bttvEmotes())
addEmotes(emotes, *bttv, text, "Channel BetterTTV");
if (auto ffz = tc->ffzEmotes())
addEmotes(emotes, *ffz, text, "Channel FrankerFaceZ");
if (auto seventv = tc->seventvEmotes())
{
addEmotes(emotes, *seventv, text, "Channel 7TV");
}
}
if (auto bttvG = getApp()->twitch->getBttvEmotes().emotes())
addEmotes(emotes, *bttvG, text, "Global BetterTTV");
if (auto ffzG = getApp()->twitch->getFfzEmotes().emotes())
addEmotes(emotes, *ffzG, text, "Global FrankerFaceZ");
if (auto seventvG = getApp()->twitch->getSeventvEmotes().globalEmotes())
{
addEmotes(emotes, *seventvG, text, "Global 7TV");
}
}
addEmojis(emotes, getApp()->emotes->emojis.emojis, text);
+1
View File
@@ -1198,6 +1198,7 @@ void Split::reloadChannelAndSubscriberEmotes()
{
twitchChannel->refreshBTTVChannelEmotes(true);
twitchChannel->refreshFFZChannelEmotes(true);
twitchChannel->refreshSevenTVChannelEmotes(true);
}
}
+1
View File
@@ -999,6 +999,7 @@ void SplitHeader::reloadChannelEmotes()
{
twitchChannel->refreshFFZChannelEmotes(true);
twitchChannel->refreshBTTVChannelEmotes(true);
twitchChannel->refreshSevenTVChannelEmotes(true);
}
}