feat: show BTTV Pro badges (#6625)
Reviewed-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -831,6 +831,7 @@ void TwitchChannel::sendMessage(const QString &message)
|
||||
|
||||
bool messageSent = false;
|
||||
this->sendMessageSignal.invoke(this->getName(), parsedMessage, messageSent);
|
||||
this->updateBttvActivity();
|
||||
this->updateSevenTVActivity();
|
||||
|
||||
if (messageSent)
|
||||
@@ -2256,6 +2257,31 @@ std::optional<CheerEmote> TwitchChannel::cheerEmote(const QString &string) const
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void TwitchChannel::updateBttvActivity()
|
||||
{
|
||||
if (!getApp()->getBttvLiveUpdates())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto now = QDateTime::currentDateTimeUtc();
|
||||
if (this->nextBttvActivity_.isValid() && now < this->nextBttvActivity_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->nextBttvActivity_ = now.addSecs(60);
|
||||
|
||||
qCDebug(chatterinoBttv) << "Sending activity in" << this->getName();
|
||||
|
||||
auto acc = getApp()->getAccounts()->twitch.getCurrent();
|
||||
if (acc->isAnon())
|
||||
{
|
||||
return;
|
||||
}
|
||||
getApp()->getBttvLiveUpdates()->broadcastMe(this->roomId(),
|
||||
acc->getUserId());
|
||||
}
|
||||
|
||||
void TwitchChannel::updateSevenTVActivity()
|
||||
{
|
||||
static const QString seventvActivityUrl =
|
||||
|
||||
@@ -377,6 +377,9 @@ private:
|
||||
|
||||
/** Joins (subscribes to) a Twitch channel for updates on BTTV. */
|
||||
void joinBttvChannel() const;
|
||||
|
||||
void updateBttvActivity();
|
||||
|
||||
/**
|
||||
* Indicates an activity to 7TV in this channel for this user.
|
||||
* This is done at most once every 60s.
|
||||
@@ -514,6 +517,8 @@ private:
|
||||
*/
|
||||
QDateTime nextSeventvActivity_;
|
||||
|
||||
QDateTime nextBttvActivity_;
|
||||
|
||||
/** The platform of the last live emote update ("7TV", "BTTV", "FFZ"). */
|
||||
QString lastLiveUpdateEmotePlatform_;
|
||||
/** The actor name of the last live emote update. */
|
||||
|
||||
Reference in New Issue
Block a user