feat: Add 7TV Emotes and Badges (#4002)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "messages/Message.hpp"
|
||||
#include "providers/chatterino/ChatterinoBadges.hpp"
|
||||
#include "providers/ffz/FfzBadges.hpp"
|
||||
#include "providers/seventv/SeventvBadges.hpp"
|
||||
#include "providers/twitch/TwitchBadge.hpp"
|
||||
#include "providers/twitch/TwitchBadges.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
@@ -280,6 +281,7 @@ MessagePtr TwitchMessageBuilder::build()
|
||||
|
||||
this->appendChatterinoBadges();
|
||||
this->appendFfzBadges();
|
||||
this->appendSeventvBadges();
|
||||
|
||||
this->appendUsername();
|
||||
|
||||
@@ -1028,6 +1030,7 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
|
||||
|
||||
const auto &globalBttvEmotes = app->twitch->getBttvEmotes();
|
||||
const auto &globalFfzEmotes = app->twitch->getFfzEmotes();
|
||||
const auto &globalSeventvEmotes = app->twitch->getSeventvEmotes();
|
||||
|
||||
auto flags = MessageElementFlags();
|
||||
auto emote = boost::optional<EmotePtr>{};
|
||||
@@ -1035,8 +1038,10 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
|
||||
// Emote order:
|
||||
// - FrankerFaceZ Channel
|
||||
// - BetterTTV Channel
|
||||
// - 7TV Channel
|
||||
// - FrankerFaceZ Global
|
||||
// - BetterTTV Global
|
||||
// - 7TV Global
|
||||
if (this->twitchChannel && (emote = this->twitchChannel->ffzEmote(name)))
|
||||
{
|
||||
flags = MessageElementFlag::FfzEmote;
|
||||
@@ -1046,6 +1051,15 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
|
||||
{
|
||||
flags = MessageElementFlag::BttvEmote;
|
||||
}
|
||||
else if (this->twitchChannel != nullptr &&
|
||||
(emote = this->twitchChannel->seventvEmote(name)))
|
||||
{
|
||||
flags = MessageElementFlag::SevenTVEmote;
|
||||
if (emote.value()->zeroWidth)
|
||||
{
|
||||
flags.set(MessageElementFlag::ZeroWidthEmote);
|
||||
}
|
||||
}
|
||||
else if ((emote = globalFfzEmotes.emote(name)))
|
||||
{
|
||||
flags = MessageElementFlag::FfzEmote;
|
||||
@@ -1059,6 +1073,14 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
|
||||
flags.set(MessageElementFlag::ZeroWidthEmote);
|
||||
}
|
||||
}
|
||||
else if ((emote = globalSeventvEmotes.globalEmote(name)))
|
||||
{
|
||||
flags = MessageElementFlag::SevenTVEmote;
|
||||
if (emote.value()->zeroWidth)
|
||||
{
|
||||
flags.set(MessageElementFlag::ZeroWidthEmote);
|
||||
}
|
||||
}
|
||||
|
||||
if (emote)
|
||||
{
|
||||
@@ -1217,6 +1239,14 @@ void TwitchMessageBuilder::appendFfzBadges()
|
||||
}
|
||||
}
|
||||
|
||||
void TwitchMessageBuilder::appendSeventvBadges()
|
||||
{
|
||||
if (auto badge = getApp()->seventvBadges->getBadge({this->userId_}))
|
||||
{
|
||||
this->emplace<BadgeElement>(*badge, MessageElementFlag::BadgeSevenTV);
|
||||
}
|
||||
}
|
||||
|
||||
Outcome TwitchMessageBuilder::tryParseCheermote(const QString &string)
|
||||
{
|
||||
if (this->bitsLeft == 0)
|
||||
|
||||
Reference in New Issue
Block a user