Add support FrankerFaceZ badges. (#2101)

On startup, we poll https://api.frankerfacez.com/v1/badges/ids and store the mappings of user IDs to badges for the remainder of the applications lifetime.
This commit is contained in:
Mm2PL
2020-10-25 09:36:00 +00:00
committed by GitHub
parent ec94869480
commit 3ee08b9ffd
16 changed files with 222 additions and 36 deletions
@@ -6,6 +6,7 @@
#include "controllers/ignores/IgnorePhrase.hpp"
#include "messages/Message.hpp"
#include "providers/chatterino/ChatterinoBadges.hpp"
#include "providers/ffz/FfzBadges.hpp"
#include "providers/twitch/TwitchBadges.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchCommon.hpp"
@@ -255,6 +256,7 @@ MessagePtr TwitchMessageBuilder::build()
this->appendTwitchBadges();
this->appendChatterinoBadges();
this->appendFfzBadges();
this->appendUsername();
@@ -1090,6 +1092,18 @@ void TwitchMessageBuilder::appendChatterinoBadges()
}
}
void TwitchMessageBuilder::appendFfzBadges()
{
if (auto badge = getApp()->ffzBadges->getBadge({this->userId_}))
{
if (auto color = getApp()->ffzBadges->getBadgeColor({this->userId_}))
{
this->emplace<FfzBadgeElement>(*badge, MessageElementFlag::BadgeFfz,
color.get());
}
}
}
Outcome TwitchMessageBuilder::tryParseCheermote(const QString &string)
{
if (this->bitsLeft == 0)