/live split for channels going live (#1998)

Co-authored-by: 23rd <23rd@vivaldi.net>
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
apa420
2021-05-09 16:17:04 +02:00
committed by GitHub
parent d96f4575ba
commit dcd65b5978
14 changed files with 104 additions and 12 deletions
+15
View File
@@ -563,10 +563,25 @@ void TwitchChannel::setLive(bool newLiveStatus)
getApp()->windows->sendAlert();
}
}
// Channel live message
MessageBuilder builder;
TwitchMessageBuilder::liveSystemMessage(this->getDisplayName(),
&builder);
this->addMessage(builder.release());
// Message in /live channel
MessageBuilder builder2;
TwitchMessageBuilder::liveMessage(this->getDisplayName(),
&builder2);
getApp()->twitch2->liveChannel->addMessage(builder2.release());
// Notify on all channels with a ping sound
if (getSettings()->notificationOnAnyChannel &&
!(isInStreamerMode() &&
getSettings()->streamerModeSuppressLiveNotifications))
{
getApp()->notifications->playSound();
}
}
else
{
+7
View File
@@ -28,6 +28,7 @@ TwitchIrcServer::TwitchIrcServer()
: whispersChannel(new Channel("/whispers", Channel::Type::TwitchWhispers))
, mentionsChannel(new Channel("/mentions", Channel::Type::TwitchMentions))
, watchingChannel(Channel::getEmpty(), Channel::Type::TwitchWatching)
, liveChannel(new Channel("/live", Channel::Type::TwitchLive))
{
this->initializeIrc();
@@ -257,6 +258,11 @@ std::shared_ptr<Channel> TwitchIrcServer::getCustomChannel(
return this->mentionsChannel;
}
if (channelName == "/live")
{
return this->liveChannel;
}
if (channelName == "$$$")
{
static auto channel =
@@ -289,6 +295,7 @@ void TwitchIrcServer::forEachChannelAndSpecialChannels(
func(this->whispersChannel);
func(this->mentionsChannel);
func(this->liveChannel);
}
std::shared_ptr<Channel> TwitchIrcServer::getChannelOrEmptyByID(
+1
View File
@@ -35,6 +35,7 @@ public:
const ChannelPtr whispersChannel;
const ChannelPtr mentionsChannel;
const ChannelPtr liveChannel;
IndirectChannel watchingChannel;
PubSub *pubsub;
@@ -1302,6 +1302,18 @@ void TwitchMessageBuilder::appendChannelPointRewardMessage(
builder->message().flags.set(MessageFlag::RedeemedChannelPointReward);
}
void TwitchMessageBuilder::liveMessage(const QString &channelName,
MessageBuilder *builder)
{
builder->emplace<TimestampElement>();
builder
->emplace<TextElement>(channelName, MessageElementFlag::Username,
MessageColor::Text, FontStyle::ChatMediumBold)
->setLink({Link::UserInfo, channelName});
builder->emplace<TextElement>("is live!", MessageElementFlag::Text,
MessageColor::Text);
}
void TwitchMessageBuilder::liveSystemMessage(const QString &channelName,
MessageBuilder *builder)
{
@@ -52,6 +52,12 @@ public:
static void appendChannelPointRewardMessage(
const ChannelPointReward &reward, MessageBuilder *builder);
// Message in the /live chat for channel going live
static void liveMessage(const QString &channelName,
MessageBuilder *builder);
// Messages in normal chat for channel stuff
static void liveSystemMessage(const QString &channelName,
MessageBuilder *builder);
static void offlineSystemMessage(const QString &channelName,