feat: add filter for external badges (#6709)

Co-authored-by: Ava Chow <github@achow101.com>
Reviewed-by: Nerixyz <nerixdev@outlook.de>
This commit is contained in:
pajlada
2026-01-05 16:20:21 +01:00
committed by GitHub
parent 25ea6b9214
commit 327dc0ebcb
186 changed files with 554 additions and 40 deletions
+23 -11
View File
@@ -478,12 +478,11 @@ public:
->twitch.getCurrent()
->blockUserLocally(u"12345"_s, u"blocked"_s);
auto makeBadge = [](QStringView platform) {
auto makeBadge = [](QStringView platform, QStringView name) {
return std::make_shared<Emote>(Emote{
.name = {},
.images = {Url{u"https://chatterino.com/" % platform %
u".png"}},
.tooltip = {platform % u" badge"},
.name = {platform.toString().toLower() % ':' % name},
.images = {Url{u"https://chatterino.com/" % name % u".png"}},
.tooltip = {name % u" badge"},
.homePage = {},
.zeroWidth = false,
.id = {},
@@ -494,17 +493,21 @@ public:
// Chatterino
this->mockApplication->chatterinoBadges.setBadge(
{u"123456"_s}, makeBadge(u"Chatterino"));
{u"123456"_s}, makeBadge(u"chatterino", u"Chatterino"));
// FFZ
// FrankerFaceZ
this->mockApplication->ffzBadges.registerBadge(
1, {.emote = makeBadge(u"FFZ1"), .color = {9, 10, 11, 12}});
1, {.emote = makeBadge(u"frankerfacez", u"FFZ1"),
.color = {9, 10, 11, 12}});
this->mockApplication->ffzBadges.registerBadge(
2, {.emote = makeBadge(u"FFZ2"), .color = {13, 14, 15, 16}});
2, {.emote = makeBadge(u"frankerfacez", u"FFZ2"),
.color = {13, 14, 15, 16}});
this->mockApplication->ffzBadges.registerBadge(
3, {.emote = makeBadge(u"FFZ2"), .color = {17, 18, 19, 20}});
3, {.emote = makeBadge(u"frankerfacez", u"FFZ2"),
.color = {17, 18, 19, 20}});
this->mockApplication->ffzBadges.registerBadge(
4, {.emote = makeBadge(u"FFZ2"), .color = {21, 22, 23, 24}});
4, {.emote = makeBadge(u"frankerfacez", u"FFZ2"),
.color = {21, 22, 23, 24}});
this->mockApplication->getFfzBadges()->assignBadgeToUser({u"123456"_s},
1);
this->mockApplication->getFfzBadges()->assignBadgeToUser({u"123456"_s},
@@ -513,6 +516,7 @@ public:
// 7TV
this->mockApplication->getSeventvBadges()->registerBadge({
{u"id"_s, u"1"_s},
{u"name"_s, u"7TV badge name"_s},
{u"tooltip"_s, u"7TV badge"_s},
{
u"host"_s,
@@ -532,6 +536,14 @@ public:
this->mockApplication->getSeventvBadges()->assignBadgeToUser(
u"1"_s, {u"123456"_s});
// BetterTTV
this->mockApplication->getBttvBadges()->registerBadge({
{u"startedAt"_s, u"2017-01-11T09:54:10.000Z"_s},
{u"url"_s, u"https://chatterino.com/betterttv/test.png"_s},
});
this->mockApplication->getBttvBadges()->assignBadgeToUser(
u"https://chatterino.com/betterttv/test.png"_s, {u"123456"_s});
// Twitch
this->mockApplication->getTwitchBadges()->loadLocalBadges();