feat: add initial experimental Twitch Eventsub support (#5837)
Co-authored-by: nerix <nerixdev@outlook.de>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "messages/Message.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "messages/MessageElement.hpp"
|
||||
#include "providers/twitch/eventsub/Controller.hpp"
|
||||
#include "providers/twitch/PubSubActions.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
@@ -189,4 +190,57 @@ QString debugTest(const CommandContext &ctx)
|
||||
return "";
|
||||
}
|
||||
|
||||
QString debugEventSub(const CommandContext &ctx)
|
||||
{
|
||||
(void)ctx;
|
||||
|
||||
if (ctx.twitchChannel == nullptr)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
// purposefully subscribe multiple times to ensure we can't sub too many times
|
||||
// or create too many connections
|
||||
|
||||
static eventsub::SubscriptionHandle handle1;
|
||||
|
||||
handle1 = getApp()->getEventSub()->subscribe(eventsub::SubscriptionRequest{
|
||||
.subscriptionType = "channel.ban",
|
||||
.subscriptionVersion = "1",
|
||||
.conditions =
|
||||
{
|
||||
{
|
||||
"broadcaster_user_id",
|
||||
ctx.twitchChannel->roomId(),
|
||||
},
|
||||
},
|
||||
});
|
||||
auto handle2 =
|
||||
getApp()->getEventSub()->subscribe(eventsub::SubscriptionRequest{
|
||||
.subscriptionType = "channel.ban",
|
||||
.subscriptionVersion = "1",
|
||||
.conditions =
|
||||
{
|
||||
{
|
||||
"broadcaster_user_id",
|
||||
ctx.twitchChannel->roomId(),
|
||||
},
|
||||
},
|
||||
});
|
||||
auto handle3 =
|
||||
getApp()->getEventSub()->subscribe(eventsub::SubscriptionRequest{
|
||||
.subscriptionType = "channel.ban",
|
||||
.subscriptionVersion = "1",
|
||||
.conditions =
|
||||
{
|
||||
{
|
||||
"broadcaster_user_id",
|
||||
ctx.twitchChannel->roomId(),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace chatterino::commands
|
||||
|
||||
Reference in New Issue
Block a user