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
+8 -5
View File
@@ -12,6 +12,7 @@ namespace chatterino::filters {
const QMap<QString, Type> MESSAGE_TYPING_CONTEXT{
{"author.badges", Type::StringList},
{"author.external_badges", Type::StringList},
{"author.color", Type::Color},
{"author.name", Type::String},
{"author.user_id", Type::String},
@@ -49,16 +50,17 @@ ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel)
{
auto watchingChannel = getApp()->getTwitch()->getWatchingChannel().get();
/*
* Looking to add a new identifier to filters? Here's what to do:
* 1. Update validIdentifiersMap in Tokenizer.cpp
/*
* Looking to add a new identifier to filters? Here's what to do:
* 1. Update VALID_IDENTIFIERS_MAP in Tokenizer.cpp
* 2. Add the identifier to the list below
* 3. Add the type of the identifier to MESSAGE_TYPING_CONTEXT in Filter.hpp
* 3. Add the type of the identifier to MESSAGE_TYPING_CONTEXT at the top of this file
* 4. Add the value for the identifier to the ContextMap returned by this function
*
*
* List of identifiers:
*
* author.badges
* author.external_badges
* author.color
* author.name
* author.user_id
@@ -121,6 +123,7 @@ ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel)
}
ContextMap vars = {
{"author.badges", std::move(badges)},
{"author.external_badges", m->externalBadges},
{"author.color", m->usernameColor},
{"author.name", m->displayName},
{"author.user_id", m->userID},
@@ -18,6 +18,7 @@ namespace chatterino::filters {
const QMap<QString, QString> VALID_IDENTIFIERS_MAP{
{"author.badges", "author badges"},
{"author.external_badges", "author external badges"},
{"author.color", "author color"},
{"author.name", "author name"},
{"author.user_id", "author user id"},