2019-12-01 13:32:41 +01:00
|
|
|
#include "providers/twitch/TwitchBadge.hpp"
|
|
|
|
|
|
|
|
#include <QSet>
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
// set of badge IDs that should be given specific flags.
|
|
|
|
// vanity flag is left out on purpose as it is our default flag
|
|
|
|
const QSet<QString> globalAuthority{"staff", "admin", "global_mod"};
|
2021-04-25 14:37:19 +02:00
|
|
|
const QSet<QString> predictions{"predictions"};
|
2019-12-01 13:32:41 +01:00
|
|
|
const QSet<QString> channelAuthority{"moderator", "vip", "broadcaster"};
|
|
|
|
const QSet<QString> subBadges{"subscriber", "founder"};
|
|
|
|
|
|
|
|
Badge::Badge(QString key, QString value)
|
|
|
|
: key_(std::move(key))
|
|
|
|
, value_(std::move(value))
|
|
|
|
{
|
|
|
|
if (globalAuthority.contains(this->key_))
|
|
|
|
{
|
|
|
|
this->flag_ = MessageElementFlag::BadgeGlobalAuthority;
|
|
|
|
}
|
2021-04-25 14:37:19 +02:00
|
|
|
else if (predictions.contains(this->key_))
|
|
|
|
{
|
|
|
|
this->flag_ = MessageElementFlag::BadgePredictions;
|
|
|
|
}
|
2019-12-01 13:32:41 +01:00
|
|
|
else if (channelAuthority.contains(this->key_))
|
|
|
|
{
|
|
|
|
this->flag_ = MessageElementFlag::BadgeChannelAuthority;
|
|
|
|
}
|
|
|
|
else if (subBadges.contains(this->key_))
|
|
|
|
{
|
|
|
|
this->flag_ = MessageElementFlag::BadgeSubscription;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace chatterino
|