feat(eventsub): implement channel.chat.user_message_(hold/update) (#6008)
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include "twitch-eventsub-ws/payloads/channel-ban-v1.hpp"
|
||||
#include "twitch-eventsub-ws/payloads/channel-chat-message-v1.hpp"
|
||||
#include "twitch-eventsub-ws/payloads/channel-chat-notification-v1.hpp"
|
||||
#include "twitch-eventsub-ws/payloads/channel-chat-user-message-hold-v1.hpp"
|
||||
#include "twitch-eventsub-ws/payloads/channel-chat-user-message-update-v1.hpp"
|
||||
#include "twitch-eventsub-ws/payloads/channel-moderate-v2.hpp"
|
||||
#include "twitch-eventsub-ws/payloads/channel-suspicious-user-message-v1.hpp"
|
||||
#include "twitch-eventsub-ws/payloads/channel-suspicious-user-update-v1.hpp"
|
||||
@@ -74,6 +76,16 @@ public:
|
||||
const messages::Metadata &metadata,
|
||||
const payload::channel_suspicious_user_update::v1::Payload
|
||||
&payload) = 0;
|
||||
|
||||
virtual void onChannelChatUserMessageHold(
|
||||
const messages::Metadata &metadata,
|
||||
const payload::channel_chat_user_message_hold::v1::Payload
|
||||
&payload) = 0;
|
||||
|
||||
virtual void onChannelChatUserMessageUpdate(
|
||||
const messages::Metadata &metadata,
|
||||
const payload::channel_chat_user_message_update::v1::Payload
|
||||
&payload) = 0;
|
||||
// Add your new subscription types above this line
|
||||
};
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#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>
|
||||
|
||||
namespace chatterino::eventsub::lib::payload::channel_chat_user_message_hold::
|
||||
v1 {
|
||||
|
||||
// {"subscription":{"id":"94ab19f1-dd41-41e7-a5bc-f8f45bd4342a","status":"enabled","type":"channel.chat.user_message_hold","version":"1","condition":{"broadcaster_user_id":"117166826","user_id":"159849156"},"transport":{"method":"websocket","session_id":"AgoQP515xn0yRxGvyU29dY9grBIGY2VsbC1j"},"created_at":"2025-03-01T10:40:14.527982426Z","cost":0},"event":{"broadcaster_user_id":"117166826","broadcaster_user_login":"testaccount_420","broadcaster_user_name":"테스트계정420","user_id":"159849156","user_login":"bajlada","user_name":"BajLada","message_id":"e39e3c58-3d25-49fd-8c94-e776ef57a7f8","message":{"text":"penis penis penis","fragments":[{"type":"text","text":"penis penis penis","cheermote":null,"emote":null}]}}}
|
||||
|
||||
struct Event {
|
||||
// Broadcaster of the channel the message was sent in
|
||||
String broadcasterUserID;
|
||||
String broadcasterUserLogin;
|
||||
String broadcasterUserName;
|
||||
|
||||
// User who sent the message
|
||||
String userID;
|
||||
String userLogin;
|
||||
String userName;
|
||||
|
||||
String messageID;
|
||||
chat::Message message;
|
||||
};
|
||||
|
||||
struct Payload {
|
||||
subscription::Subscription subscription;
|
||||
|
||||
Event event;
|
||||
};
|
||||
|
||||
#include "twitch-eventsub-ws/payloads/channel-chat-user-message-hold-v1.inc"
|
||||
|
||||
} // namespace chatterino::eventsub::lib::payload::channel_chat_user_message_hold::v1
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
boost::json::try_value_to_tag<Event>, const boost::json::value &jvRoot);
|
||||
|
||||
boost::json::result_for<Payload, boost::json::value>::type tag_invoke(
|
||||
boost::json::try_value_to_tag<Payload>, const boost::json::value &jvRoot);
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#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>
|
||||
|
||||
namespace chatterino::eventsub::lib::payload::channel_chat_user_message_update::
|
||||
v1 {
|
||||
|
||||
// message approved:
|
||||
// {"subscription":{"id":"3a9fd3ec-f5b5-49d7-8624-2195b3ebfda9","status":"enabled","type":"channel.chat.user_message_update","version":"1","condition":{"broadcaster_user_id":"117166826","user_id":"159849156"},"transport":{"method":"websocket","session_id":"AgoQBFnyoXrLQxiCmkHTvJ8VNBIGY2VsbC1j"},"created_at":"2025-03-01T11:29:49.532375428Z","cost":0},"event":{"broadcaster_user_id":"117166826","broadcaster_user_login":"testaccount_420","broadcaster_user_name":"테스트계정420","user_id":"159849156","user_login":"bajlada","user_name":"BajLada","status":"approved","message_id":"5686ec52-e02c-4042-ac21-1dfd8cab0f9f","message":{"text":"penis ass penis","fragments":[{"type":"text","text":"penis ass penis","cheermote":null,"emote":null}]}}}
|
||||
|
||||
// message denied:
|
||||
// {"subscription":{"id":"3a9fd3ec-f5b5-49d7-8624-2195b3ebfda9","status":"enabled","type":"channel.chat.user_message_update","version":"1","condition":{"broadcaster_user_id":"117166826","user_id":"159849156"},"transport":{"method":"websocket","session_id":"AgoQBFnyoXrLQxiCmkHTvJ8VNBIGY2VsbC1j"},"created_at":"2025-03-01T11:29:49.532375428Z","cost":0},"event":{"broadcaster_user_id":"117166826","broadcaster_user_login":"testaccount_420","broadcaster_user_name":"테스트계정420","user_id":"159849156","user_login":"bajlada","user_name":"BajLada","status":"denied","message_id":"fc90dc3b-0634-41c3-8365-f40719f076ab","message":{"text":"penis ass penis","fragments":[{"type":"text","text":"penis ","cheermote":null,"emote":null},{"type":"text","text":"ass penis","cheermote":null,"emote":null}]}}}
|
||||
|
||||
enum class Status : std::uint8_t {
|
||||
Approved,
|
||||
Denied,
|
||||
Invalid,
|
||||
};
|
||||
|
||||
struct Event {
|
||||
// Broadcaster of the channel the message was sent in
|
||||
String broadcasterUserID;
|
||||
String broadcasterUserLogin;
|
||||
String broadcasterUserName;
|
||||
|
||||
// User who sent the message
|
||||
String userID;
|
||||
String userLogin;
|
||||
String userName;
|
||||
|
||||
Status status;
|
||||
|
||||
String messageID;
|
||||
chat::Message message;
|
||||
};
|
||||
|
||||
struct Payload {
|
||||
subscription::Subscription subscription;
|
||||
|
||||
Event event;
|
||||
};
|
||||
|
||||
#include "twitch-eventsub-ws/payloads/channel-chat-user-message-update-v1.inc"
|
||||
|
||||
} // namespace chatterino::eventsub::lib::payload::channel_chat_user_message_update::v1
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
boost::json::result_for<Status, boost::json::value>::type tag_invoke(
|
||||
boost::json::try_value_to_tag<Status>, const boost::json::value &jvRoot);
|
||||
|
||||
boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
boost::json::try_value_to_tag<Event>, const boost::json::value &jvRoot);
|
||||
|
||||
boost::json::result_for<Payload, boost::json::value>::type tag_invoke(
|
||||
boost::json::try_value_to_tag<Payload>, const boost::json::value &jvRoot);
|
||||
Reference in New Issue
Block a user