mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Rework badge types to fit with the way twitch sends badges
This commit is contained in:
parent
56e521bc24
commit
8f4e20db8e
|
@ -35,29 +35,47 @@ public:
|
||||||
BitsStatic = (1 << 12),
|
BitsStatic = (1 << 12),
|
||||||
BitsAnimated = (1 << 13),
|
BitsAnimated = (1 << 13),
|
||||||
|
|
||||||
BadgeStaff = (1 << 14),
|
// Slot 1: Twitch
|
||||||
BadgeAdmin = (1 << 15),
|
// - Staff badge
|
||||||
BadgeGlobalMod = (1 << 16),
|
// - Admin badge
|
||||||
BadgeModerator = (1 << 17),
|
// - Global Moderator badge
|
||||||
BadgeTurbo = (1 << 18),
|
BadgeGlobalAuthority = (1 << 14),
|
||||||
BadgeBroadcaster = (1 << 19),
|
|
||||||
BadgePremium = (1 << 20),
|
|
||||||
BadgeChatterino = (1 << 21),
|
|
||||||
BadgeCheer = (1 << 22),
|
|
||||||
BadgeVerified = (1 << 23),
|
|
||||||
BadgeMiscellaneous = (1 << 24),
|
|
||||||
Badges = BadgeStaff | BadgeAdmin | BadgeGlobalMod | BadgeModerator | BadgeTurbo |
|
|
||||||
BadgeBroadcaster | BadgePremium | BadgeChatterino | BadgeCheer | BadgeVerified |
|
|
||||||
BadgeMiscellaneous,
|
|
||||||
|
|
||||||
Username = (1 << 25),
|
// Slot 2: Twitch
|
||||||
BitsAmount = (1 << 26),
|
// - Moderator badge
|
||||||
|
// - Broadcaster badge
|
||||||
|
BadgeChannelAuthority = (1 << 15),
|
||||||
|
|
||||||
ButtonBan = (1 << 27),
|
// Slot 3: Twitch
|
||||||
ButtonTimeout = (1 << 28),
|
// - Subscription badges
|
||||||
|
BadgeSubscription = (1 << 16),
|
||||||
|
|
||||||
EmojiImage = (1 << 29),
|
// Slot 4: Twitch
|
||||||
EmojiText = (1 << 30),
|
// - Turbo badge
|
||||||
|
// - Prime badge
|
||||||
|
// - Bit badges
|
||||||
|
// - Game badges
|
||||||
|
BadgeVanity = (1 << 17),
|
||||||
|
|
||||||
|
// Slot 5: Chatterino
|
||||||
|
// - Chatterino developer badge
|
||||||
|
// - Chatterino donator badge
|
||||||
|
// - Chatterino top donator badge
|
||||||
|
BadgeChatterino = (1 << 18),
|
||||||
|
|
||||||
|
// Rest of slots: ffz custom badge? bttv custom badge? mywaifu (puke) custom badge?
|
||||||
|
|
||||||
|
Badges = BadgeGlobalAuthority | BadgeChannelAuthority | BadgeSubscription | BadgeVanity |
|
||||||
|
BadgeChatterino,
|
||||||
|
|
||||||
|
Username = (1 << 19),
|
||||||
|
BitsAmount = (1 << 20),
|
||||||
|
|
||||||
|
ButtonBan = (1 << 21),
|
||||||
|
ButtonTimeout = (1 << 22),
|
||||||
|
|
||||||
|
EmojiImage = (1 << 23),
|
||||||
|
EmojiText = (1 << 34),
|
||||||
|
|
||||||
Default = TimestampNoSeconds | Badges | Username | BitsStatic | FfzEmoteImage |
|
Default = TimestampNoSeconds | Badges | Username | BitsStatic | FfzEmoteImage |
|
||||||
BttvEmoteImage | BttvGifEmoteImage | TwitchEmoteImage | BitsAmount | Text |
|
BttvEmoteImage | BttvGifEmoteImage | TwitchEmoteImage | BitsAmount | Text |
|
||||||
|
|
|
@ -373,7 +373,7 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges, Resourc
|
||||||
auto &badgeVersion = badgeSet.versions.at(versionKey);
|
auto &badgeVersion = badgeSet.versions.at(versionKey);
|
||||||
|
|
||||||
appendWord(
|
appendWord(
|
||||||
Word(badgeVersion.badgeImage1x, Word::BadgeCheer, QString(),
|
Word(badgeVersion.badgeImage1x, Word::BadgeVanity, QString(),
|
||||||
QString("Twitch " + QString::fromStdString(badgeVersion.title))));
|
QString("Twitch " + QString::fromStdString(badgeVersion.title))));
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
qDebug() << "Exception caught:" << e.what()
|
qDebug() << "Exception caught:" << e.what()
|
||||||
|
@ -386,33 +386,33 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges, Resourc
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (badge == "staff/1") {
|
} else if (badge == "staff/1") {
|
||||||
appendWord(
|
appendWord(Word(resources.badgeStaff, Word::BadgeGlobalAuthority, QString(),
|
||||||
Word(resources.badgeStaff, Word::BadgeStaff, QString(), QString("Twitch Staff")));
|
QString("Twitch Staff")));
|
||||||
} else if (badge == "admin/1") {
|
} else if (badge == "admin/1") {
|
||||||
appendWord(
|
appendWord(Word(resources.badgeAdmin, Word::BadgeGlobalAuthority, QString(),
|
||||||
Word(resources.badgeAdmin, Word::BadgeAdmin, QString(), QString("Twitch Admin")));
|
QString("Twitch Admin")));
|
||||||
} else if (badge == "global_mod/1") {
|
} else if (badge == "global_mod/1") {
|
||||||
appendWord(Word(resources.badgeGlobalModerator, Word::BadgeGlobalMod, QString(),
|
appendWord(Word(resources.badgeGlobalModerator, Word::BadgeGlobalAuthority, QString(),
|
||||||
QString("Global Moderator")));
|
QString("Global Moderator")));
|
||||||
} else if (badge == "moderator/1") {
|
} else if (badge == "moderator/1") {
|
||||||
// TODO: Implement custom FFZ moderator badge
|
// TODO: Implement custom FFZ moderator badge
|
||||||
appendWord(Word(resources.badgeModerator, Word::BadgeModerator, QString(),
|
appendWord(Word(resources.badgeModerator, Word::BadgeChannelAuthority, QString(),
|
||||||
QString("Channel Moderator"))); // custom badge
|
QString("Channel Moderator"))); // custom badge
|
||||||
} else if (badge == "turbo/1") {
|
} else if (badge == "turbo/1") {
|
||||||
appendWord(Word(resources.badgeStaff, Word::BadgeTurbo, QString(),
|
appendWord(Word(resources.badgeStaff, Word::BadgeVanity, QString(),
|
||||||
QString("Turbo Subscriber")));
|
QString("Turbo Subscriber")));
|
||||||
} else if (badge == "broadcaster/1") {
|
} else if (badge == "broadcaster/1") {
|
||||||
appendWord(Word(resources.badgeBroadcaster, Word::BadgeBroadcaster, QString(),
|
appendWord(Word(resources.badgeBroadcaster, Word::BadgeChannelAuthority, QString(),
|
||||||
QString("Channel Broadcaster")));
|
QString("Channel Broadcaster")));
|
||||||
} else if (badge == "premium/1") {
|
} else if (badge == "premium/1") {
|
||||||
appendWord(Word(resources.badgePremium, Word::BadgePremium, QString(),
|
appendWord(Word(resources.badgePremium, Word::BadgeVanity, QString(),
|
||||||
QString("Twitch Prime")));
|
QString("Twitch Prime")));
|
||||||
|
|
||||||
} else if (badge.startsWith("partner/")) {
|
} else if (badge.startsWith("partner/")) {
|
||||||
int index = badge.midRef(8).toInt();
|
int index = badge.midRef(8).toInt();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 1: {
|
case 1: {
|
||||||
appendWord(Word(resources.badgeVerified, Word::BadgeVerified, QString(),
|
appendWord(Word(resources.badgeVerified, Word::BadgeVanity, QString(),
|
||||||
"Twitch Verified"));
|
"Twitch Verified"));
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
@ -442,7 +442,7 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges, Resourc
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Word::Type badgeType = Word::Type::BadgeMiscellaneous;
|
Word::Type badgeType = Word::Type::BadgeVanity;
|
||||||
|
|
||||||
std::string badgeSetKey = parts[0].toStdString();
|
std::string badgeSetKey = parts[0].toStdString();
|
||||||
std::string versionKey = parts[1].toStdString();
|
std::string versionKey = parts[1].toStdString();
|
||||||
|
|
Loading…
Reference in a new issue