mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Add channel.live filter variable (#3092)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
3cb1e5158a
commit
d7e8f4eabd
|
@ -9,6 +9,7 @@
|
|||
- Minor: Received IRC messages use `time` message tag for timestamp if it's available. (#3021)
|
||||
- Minor: Added informative messages for recent-messages API's errors. (#3029)
|
||||
- Minor: Added section with helpful Chatterino-related links to the About page. (#3068)
|
||||
- Minor: Added `channel.live` filter variable (#3092)
|
||||
- Bugfix: Fixed "smiley" emotes being unable to be "Tabbed" with autocompletion, introduced in v2.3.3. (#3010)
|
||||
- Bugfix: Fixed PubSub not properly trying to resolve pending listens when the pending listens list was larger than 50. (#3037)
|
||||
- Bugfix: Copy buttons in usercard now show properly in light mode (#3057)
|
||||
|
|
|
@ -61,8 +61,7 @@ ContextMap buildContextMap(const MessagePtr &m)
|
|||
subLength = m->badgeInfos.at(subBadge).toInt();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
ContextMap vars = {
|
||||
{"author.badges", std::move(badges)},
|
||||
{"author.color", m->usernameColor},
|
||||
{"author.name", m->displayName},
|
||||
|
@ -82,6 +81,20 @@ ContextMap buildContextMap(const MessagePtr &m)
|
|||
{"message.content", m->messageText},
|
||||
{"message.length", m->messageText.length()},
|
||||
};
|
||||
{
|
||||
using namespace chatterino;
|
||||
auto channel = getApp()->twitch2->getChannelOrEmpty(m->channelName);
|
||||
auto *tc = dynamic_cast<TwitchChannel *>(channel.get());
|
||||
if (!channel->isEmpty() && tc)
|
||||
{
|
||||
vars["channel.live"] = tc->isLive();
|
||||
}
|
||||
else
|
||||
{
|
||||
vars["channel.live"] = false;
|
||||
}
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
|
||||
FilterParser::FilterParser(const QString &text)
|
||||
|
|
|
@ -17,6 +17,7 @@ static const QMap<QString, QString> validIdentifiersMap = {
|
|||
{"author.sub_length", "author sub length"},
|
||||
{"channel.name", "channel name"},
|
||||
{"channel.watching", "/watching channel?"},
|
||||
{"channel.live", "Channel live?"},
|
||||
{"flags.highlighted", "highlighted?"},
|
||||
{"flags.points_redeemed", "redeemed points?"},
|
||||
{"flags.sub_message", "sub/resub message?"},
|
||||
|
|
Loading…
Reference in a new issue