nit: fix some eventsub mini things (#5895)

This commit is contained in:
pajlada
2025-02-02 17:51:46 +01:00
committed by GitHub
parent 0f8a29fdb9
commit da0a247f16
10 changed files with 7 additions and 113 deletions
+1 -13
View File
@@ -1473,18 +1473,6 @@ void TwitchChannel::refreshPubSub()
{
getApp()->getTwitchPubSub()->listenToAutomod(roomId);
getApp()->getTwitchPubSub()->listenToLowTrustUsers(roomId);
this->eventSubChannelBanHandle =
getApp()->getEventSub()->subscribe(eventsub::SubscriptionRequest{
.subscriptionType = "channel.ban",
.subscriptionVersion = "1",
.conditions =
{
{
"broadcaster_user_id",
roomId,
},
},
});
this->eventSubChannelModerateHandle =
getApp()->getEventSub()->subscribe(eventsub::SubscriptionRequest{
@@ -1505,7 +1493,7 @@ void TwitchChannel::refreshPubSub()
}
else
{
this->eventSubChannelBanHandle.reset();
this->eventSubChannelModerateHandle.reset();
}
getApp()->getTwitchPubSub()->listenToChannelPointRewards(roomId);
}
-1
View File
@@ -500,7 +500,6 @@ private:
pajlada::Signals::SignalHolder signalHolder_;
std::vector<boost::signals2::scoped_connection> bSignals_;
eventsub::SubscriptionHandle eventSubChannelBanHandle;
eventsub::SubscriptionHandle eventSubChannelModerateHandle;
friend class TwitchIrcServer;
@@ -31,10 +31,6 @@ public:
///
/// If no open connection has room for this subscription, this function will
/// create a new connection and queue up the subscription to run again after X seconds.
///
/// TODO: Return a SubscriptionHandle that handles unsubscriptions
/// Dupe subscriptions should return shared subscription handles
/// So no more owners of the subscription handle means we send an unsubscribe request
[[nodiscard]] virtual SubscriptionHandle subscribe(
const SubscriptionRequest &request) = 0;
};
@@ -8,7 +8,7 @@ namespace chatterino::eventsub {
RawSubscriptionHandle::RawSubscriptionHandle(SubscriptionRequest request_)
: request(std::move(request_))
{
// getApp()->getEventSub()->addRef(request);
// The reference is added by the EventSub controller
}
RawSubscriptionHandle::~RawSubscriptionHandle()
@@ -14,6 +14,10 @@ struct RawSubscriptionHandle {
~RawSubscriptionHandle();
};
/// Keeps a reference count of a specific subscription
///
/// If no more references exist of a specific subscription, we send an
/// unsubscription request
using SubscriptionHandle = std::unique_ptr<RawSubscriptionHandle>;
} // namespace chatterino::eventsub