feat(eventsub): implement (shared chat) delete (#5993)

This commit is contained in:
pajlada
2025-02-26 14:33:31 +01:00
committed by GitHub
parent 1bf87e46cd
commit b957af4f50
9 changed files with 829 additions and 13 deletions
@@ -257,13 +257,14 @@ struct Unraid {
struct Delete {
static constexpr std::string_view TAG = "delete";
std::string userID;
std::string userLogin;
std::string userName;
std::string messageID;
std::string messageBody;
String userID;
String userLogin;
String userName;
String messageID;
String messageBody;
};
struct SharedChatDelete : public Ban {
struct SharedChatDelete : public Delete {
static constexpr std::string_view TAG = "shared_chat_delete";
};
@@ -771,7 +771,7 @@ boost::json::result_for<Delete, boost::json::value>::type tag_invoke(
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
}
auto userID = boost::json::try_value_to<std::string>(*jvuserID);
auto userID = boost::json::try_value_to<String>(*jvuserID);
if (userID.has_error())
{
@@ -784,7 +784,7 @@ boost::json::result_for<Delete, boost::json::value>::type tag_invoke(
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
}
auto userLogin = boost::json::try_value_to<std::string>(*jvuserLogin);
auto userLogin = boost::json::try_value_to<String>(*jvuserLogin);
if (userLogin.has_error())
{
@@ -797,7 +797,7 @@ boost::json::result_for<Delete, boost::json::value>::type tag_invoke(
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
}
auto userName = boost::json::try_value_to<std::string>(*jvuserName);
auto userName = boost::json::try_value_to<String>(*jvuserName);
if (userName.has_error())
{
@@ -810,7 +810,7 @@ boost::json::result_for<Delete, 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())
{
@@ -823,7 +823,7 @@ boost::json::result_for<Delete, boost::json::value>::type tag_invoke(
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
}
auto messageBody = boost::json::try_value_to<std::string>(*jvmessageBody);
auto messageBody = boost::json::try_value_to<String>(*jvmessageBody);
if (messageBody.has_error())
{
@@ -843,7 +843,7 @@ boost::json::result_for<SharedChatDelete, boost::json::value>::type tag_invoke(
boost::json::try_value_to_tag<SharedChatDelete> /* tag */,
const boost::json::value &jvRoot)
{
auto base = boost::json::try_value_to<Ban>(jvRoot);
auto base = boost::json::try_value_to<Delete>(jvRoot);
if (base.has_error())
{
return base.error();