feat(eventsub): implement automod message update (#6010)

This commit is contained in:
nerix
2025-03-01 15:46:41 +01:00
committed by GitHub
parent bced3c658d
commit 17a44e19bb
11 changed files with 1028 additions and 19 deletions
@@ -3,6 +3,7 @@
#include "twitch-eventsub-ws/payloads/automod-message.hpp"
#include "twitch-eventsub-ws/payloads/structured-message.hpp"
#include "twitch-eventsub-ws/payloads/subscription.hpp"
#include "twitch-eventsub-ws/string.hpp"
#include <boost/json.hpp>
@@ -12,9 +13,9 @@ namespace chatterino::eventsub::lib::payload::automod_message_update::v2 {
struct Event {
// Broadcaster of the channel the message was sent in
std::string broadcasterUserID;
std::string broadcasterUserLogin;
std::string broadcasterUserName;
String broadcasterUserID;
String broadcasterUserLogin;
String broadcasterUserName;
// User who sent the message
std::string userID;
@@ -26,7 +27,7 @@ struct Event {
std::string moderatorUserLogin;
std::string moderatorUserName;
std::string messageID;
String messageID;
chat::Message message;
// "Approved", "Denied", or "Expired"
@@ -25,7 +25,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
}
auto broadcasterUserID =
boost::json::try_value_to<std::string>(*jvbroadcasterUserID);
boost::json::try_value_to<String>(*jvbroadcasterUserID);
if (broadcasterUserID.has_error())
{
@@ -40,7 +40,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
}
auto broadcasterUserLogin =
boost::json::try_value_to<std::string>(*jvbroadcasterUserLogin);
boost::json::try_value_to<String>(*jvbroadcasterUserLogin);
if (broadcasterUserLogin.has_error())
{
@@ -55,7 +55,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
}
auto broadcasterUserName =
boost::json::try_value_to<std::string>(*jvbroadcasterUserName);
boost::json::try_value_to<String>(*jvbroadcasterUserName);
if (broadcasterUserName.has_error())
{
@@ -149,7 +149,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
}
auto messageID = boost::json::try_value_to<std::string>(*jvmessageID);
auto messageID = boost::json::try_value_to<String>(*jvmessageID);
if (messageID.has_error())
{