eventsub: add some logging when privileges change (#7143)

This commit is contained in:
pajlada
2026-08-01 13:05:24 +00:00
committed by GitHub
parent 3168fbde61
commit bac63c22d1
2 changed files with 16 additions and 0 deletions
@@ -402,6 +402,7 @@ void IrcMessageHandler::parsePrivMessageInto(
auto badgesTag = message->tag("badges"); auto badgesTag = message->tag("badges");
if (badgesTag.isValid()) if (badgesTag.isValid())
{ {
// TODO: We should not update mod or vip status from recent messages
auto parsedBadges = parseBadges(badgesTag.toString()); auto parsedBadges = parseBadges(badgesTag.toString());
channel->setMod(parsedBadges.contains("moderator") || channel->setMod(parsedBadges.contains("moderator") ||
parsedBadges.contains("lead_moderator")); parsedBadges.contains("lead_moderator"));
+15
View File
@@ -127,6 +127,10 @@ TwitchChannel::TwitchChannel(const QString &name)
this->signalHolder_.managedConnect( this->signalHolder_.managedConnect(
getApp()->getAccounts()->twitch.currentUserAboutToChange, getApp()->getAccounts()->twitch.currentUserAboutToChange,
[this](const auto & /*oldAccount*/, const auto & /*newAccount*/) { [this](const auto & /*oldAccount*/, const auto & /*newAccount*/) {
qCDebug(chatterinoTwitchEventSub)
<< "Current user about to change, drop all eventsub handles in "
"preparation"
<< this->roomId();
this->eventSubChannelChatUserMessageHoldHandle.reset(); this->eventSubChannelChatUserMessageHoldHandle.reset();
this->eventSubChannelChatUserMessageUpdateHandle.reset(); this->eventSubChannelChatUserMessageUpdateHandle.reset();
this->eventSubChannelModerateHandle.reset(); this->eventSubChannelModerateHandle.reset();
@@ -1576,6 +1580,9 @@ void TwitchChannel::refreshPubSub()
if (currentAccount->isAnon()) if (currentAccount->isAnon())
{ {
qCDebug(chatterinoTwitchEventSub)
<< "Current account is anon - drop all privileged eventsub handles"
<< this->roomId();
this->eventSubChannelModerateHandle.reset(); this->eventSubChannelModerateHandle.reset();
this->eventSubAutomodMessageHoldHandle.reset(); this->eventSubAutomodMessageHoldHandle.reset();
this->eventSubAutomodMessageUpdateHandle.reset(); this->eventSubAutomodMessageUpdateHandle.reset();
@@ -1590,6 +1597,10 @@ void TwitchChannel::refreshPubSub()
if (this->hasModRights()) if (this->hasModRights())
{ {
qCDebug(chatterinoTwitchEventSub)
<< "Current account is mod - subscribe to privileged eventsub "
"handles"
<< this->roomId();
this->eventSubChannelModerateHandle = this->eventSubChannelModerateHandle =
getApp()->getEventSub()->subscribe(eventsub::SubscriptionRequest{ getApp()->getEventSub()->subscribe(eventsub::SubscriptionRequest{
.subscriptionType = "channel.moderate", .subscriptionType = "channel.moderate",
@@ -1681,6 +1692,10 @@ void TwitchChannel::refreshPubSub()
} }
else else
{ {
qCDebug(chatterinoTwitchEventSub)
<< "Current account is no longer a moderator - drop privileged "
"eventsub handles"
<< this->roomId();
this->eventSubChannelModerateHandle.reset(); this->eventSubChannelModerateHandle.reset();
this->eventSubAutomodMessageHoldHandle.reset(); this->eventSubAutomodMessageHoldHandle.reset();
this->eventSubAutomodMessageUpdateHandle.reset(); this->eventSubAutomodMessageUpdateHandle.reset();