feat(eventsub): implement (un)mod (#6001)
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@
|
|||||||
- Bugfix: Fixed the input font not immediately updating when zooming in/out. (#5960)
|
- Bugfix: Fixed the input font not immediately updating when zooming in/out. (#5960)
|
||||||
- Bugfix: Fixed color input thinking blue is also red. (#5982)
|
- Bugfix: Fixed color input thinking blue is also red. (#5982)
|
||||||
- Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947)
|
- Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947)
|
||||||
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000)
|
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001)
|
||||||
- Dev: Remove unneeded platform specifier for toasts. (#5914)
|
- Dev: Remove unneeded platform specifier for toasts. (#5914)
|
||||||
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
||||||
- Dev: Removed unused PubSub whisper code. (#5898)
|
- Dev: Removed unused PubSub whisper code. (#5898)
|
||||||
|
|||||||
@@ -135,9 +135,9 @@ struct Unvip {
|
|||||||
struct Mod {
|
struct Mod {
|
||||||
static constexpr std::string_view TAG = "mod";
|
static constexpr std::string_view TAG = "mod";
|
||||||
|
|
||||||
std::string userID;
|
String userID;
|
||||||
std::string userLogin;
|
String userLogin;
|
||||||
std::string userName;
|
String userName;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* user is unmodded
|
/* user is unmodded
|
||||||
@@ -147,9 +147,9 @@ struct Mod {
|
|||||||
struct Unmod {
|
struct Unmod {
|
||||||
static constexpr std::string_view TAG = "unmod";
|
static constexpr std::string_view TAG = "unmod";
|
||||||
|
|
||||||
std::string userID;
|
String userID;
|
||||||
std::string userLogin;
|
String userLogin;
|
||||||
std::string userName;
|
String userName;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* user is banned with reason
|
/* user is banned with reason
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ boost::json::result_for<Mod, boost::json::value>::type tag_invoke(
|
|||||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
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())
|
if (userID.has_error())
|
||||||
{
|
{
|
||||||
@@ -226,7 +226,7 @@ boost::json::result_for<Mod, boost::json::value>::type tag_invoke(
|
|||||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
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())
|
if (userLogin.has_error())
|
||||||
{
|
{
|
||||||
@@ -239,7 +239,7 @@ boost::json::result_for<Mod, boost::json::value>::type tag_invoke(
|
|||||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
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())
|
if (userName.has_error())
|
||||||
{
|
{
|
||||||
@@ -269,7 +269,7 @@ boost::json::result_for<Unmod, boost::json::value>::type tag_invoke(
|
|||||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
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())
|
if (userID.has_error())
|
||||||
{
|
{
|
||||||
@@ -282,7 +282,7 @@ boost::json::result_for<Unmod, boost::json::value>::type tag_invoke(
|
|||||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
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())
|
if (userLogin.has_error())
|
||||||
{
|
{
|
||||||
@@ -295,7 +295,7 @@ boost::json::result_for<Unmod, boost::json::value>::type tag_invoke(
|
|||||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
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())
|
if (userName.has_error())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -388,4 +388,35 @@ void makeModerateMessage(
|
|||||||
builder.message().searchText = text;
|
builder.message().searchText = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void makeModerateMessage(EventSubMessageBuilder &builder,
|
||||||
|
const lib::payload::channel_moderate::v2::Event &event,
|
||||||
|
const lib::payload::channel_moderate::v2::Mod &action)
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
|
||||||
|
builder.appendUser(event.moderatorUserName, event.moderatorUserLogin, text);
|
||||||
|
builder.emplaceSystemTextAndUpdate(u"modded"_s, text);
|
||||||
|
builder.appendUser(action.userName, action.userLogin, text, false);
|
||||||
|
builder.emplaceSystemTextAndUpdate(u"."_s, text);
|
||||||
|
|
||||||
|
builder.message().messageText = text;
|
||||||
|
builder.message().searchText = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
void makeModerateMessage(
|
||||||
|
EventSubMessageBuilder &builder,
|
||||||
|
const lib::payload::channel_moderate::v2::Event &event,
|
||||||
|
const lib::payload::channel_moderate::v2::Unmod &action)
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
|
||||||
|
builder.appendUser(event.moderatorUserName, event.moderatorUserLogin, text);
|
||||||
|
builder.emplaceSystemTextAndUpdate(u"unmodded"_s, text);
|
||||||
|
builder.appendUser(action.userName, action.userLogin, text, false);
|
||||||
|
builder.emplaceSystemTextAndUpdate(u"."_s, text);
|
||||||
|
|
||||||
|
builder.message().messageText = text;
|
||||||
|
builder.message().searchText = text;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace chatterino::eventsub
|
} // namespace chatterino::eventsub
|
||||||
|
|||||||
@@ -122,4 +122,15 @@ void makeModerateMessage(
|
|||||||
const lib::payload::channel_moderate::v2::Event &event,
|
const lib::payload::channel_moderate::v2::Event &event,
|
||||||
const lib::payload::channel_moderate::v2::AutomodTerms &action);
|
const lib::payload::channel_moderate::v2::AutomodTerms &action);
|
||||||
|
|
||||||
|
/// <BROADCASTER> modded <MODERATOR>.
|
||||||
|
void makeModerateMessage(EventSubMessageBuilder &builder,
|
||||||
|
const lib::payload::channel_moderate::v2::Event &event,
|
||||||
|
const lib::payload::channel_moderate::v2::Mod &action);
|
||||||
|
|
||||||
|
/// <BROADCASTER> unmodded <MODERATOR>.
|
||||||
|
void makeModerateMessage(
|
||||||
|
EventSubMessageBuilder &builder,
|
||||||
|
const lib::payload::channel_moderate::v2::Event &event,
|
||||||
|
const lib::payload::channel_moderate::v2::Unmod &action);
|
||||||
|
|
||||||
} // namespace chatterino::eventsub
|
} // namespace chatterino::eventsub
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
{
|
||||||
|
"input": {
|
||||||
|
"action": "mod",
|
||||||
|
"automod_terms": null,
|
||||||
|
"ban": null,
|
||||||
|
"broadcaster_user_id": "11148817",
|
||||||
|
"broadcaster_user_login": "pajlada",
|
||||||
|
"broadcaster_user_name": "pajlada",
|
||||||
|
"delete": null,
|
||||||
|
"followers": null,
|
||||||
|
"mod": {
|
||||||
|
"user_id": "22484632",
|
||||||
|
"user_login": "forsen",
|
||||||
|
"user_name": "forsen"
|
||||||
|
},
|
||||||
|
"moderator_user_id": "489584266",
|
||||||
|
"moderator_user_login": "uint128",
|
||||||
|
"moderator_user_name": "uint128",
|
||||||
|
"raid": null,
|
||||||
|
"shared_chat_ban": null,
|
||||||
|
"shared_chat_delete": null,
|
||||||
|
"shared_chat_timeout": null,
|
||||||
|
"shared_chat_unban": null,
|
||||||
|
"shared_chat_untimeout": null,
|
||||||
|
"slow": null,
|
||||||
|
"source_broadcaster_user_id": null,
|
||||||
|
"source_broadcaster_user_login": null,
|
||||||
|
"source_broadcaster_user_name": null,
|
||||||
|
"timeout": null,
|
||||||
|
"unban": null,
|
||||||
|
"unban_request": null,
|
||||||
|
"unmod": null,
|
||||||
|
"unraid": null,
|
||||||
|
"untimeout": null,
|
||||||
|
"unvip": null,
|
||||||
|
"vip": null,
|
||||||
|
"warn": null
|
||||||
|
},
|
||||||
|
"output": [
|
||||||
|
{
|
||||||
|
"badgeInfos": {
|
||||||
|
},
|
||||||
|
"badges": [
|
||||||
|
],
|
||||||
|
"channelName": "",
|
||||||
|
"count": 1,
|
||||||
|
"displayName": "",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"element": {
|
||||||
|
"color": "System",
|
||||||
|
"flags": "Timestamp",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "TextElement",
|
||||||
|
"words": [
|
||||||
|
"12:31"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"flags": "Timestamp",
|
||||||
|
"format": "",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"time": "12:31:47",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "TimestampElement"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "Text",
|
||||||
|
"fallbackColor": "System",
|
||||||
|
"flags": "Text|Mention",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "MentionElement",
|
||||||
|
"userColor": "System",
|
||||||
|
"userLoginName": "uint128",
|
||||||
|
"words": [
|
||||||
|
"uint128"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "System",
|
||||||
|
"flags": "Text",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "TextElement",
|
||||||
|
"words": [
|
||||||
|
"modded"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "Text",
|
||||||
|
"fallbackColor": "System",
|
||||||
|
"flags": "Text|Mention",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": false,
|
||||||
|
"type": "MentionElement",
|
||||||
|
"userColor": "System",
|
||||||
|
"userLoginName": "forsen",
|
||||||
|
"words": [
|
||||||
|
"forsen"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "System",
|
||||||
|
"flags": "Text",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "TextElement",
|
||||||
|
"words": [
|
||||||
|
"."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"flags": "System|Timeout|EventSub",
|
||||||
|
"id": "",
|
||||||
|
"localizedName": "",
|
||||||
|
"loginName": "uint128",
|
||||||
|
"messageText": "uint128 modded forsen. ",
|
||||||
|
"searchText": "uint128 modded forsen. ",
|
||||||
|
"serverReceivedTime": "2024-05-14T12:31:47Z",
|
||||||
|
"timeoutUser": "",
|
||||||
|
"userID": "",
|
||||||
|
"usernameColor": "#ff000000"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
{
|
||||||
|
"input": {
|
||||||
|
"action": "unmod",
|
||||||
|
"automod_terms": null,
|
||||||
|
"ban": null,
|
||||||
|
"broadcaster_user_id": "11148817",
|
||||||
|
"broadcaster_user_login": "pajlada",
|
||||||
|
"broadcaster_user_name": "pajlada",
|
||||||
|
"delete": null,
|
||||||
|
"followers": null,
|
||||||
|
"mod": null,
|
||||||
|
"moderator_user_id": "489584266",
|
||||||
|
"moderator_user_login": "uint128",
|
||||||
|
"moderator_user_name": "uint128",
|
||||||
|
"raid": null,
|
||||||
|
"shared_chat_ban": null,
|
||||||
|
"shared_chat_delete": null,
|
||||||
|
"shared_chat_timeout": null,
|
||||||
|
"shared_chat_unban": null,
|
||||||
|
"shared_chat_untimeout": null,
|
||||||
|
"slow": null,
|
||||||
|
"source_broadcaster_user_id": null,
|
||||||
|
"source_broadcaster_user_login": null,
|
||||||
|
"source_broadcaster_user_name": null,
|
||||||
|
"timeout": null,
|
||||||
|
"unban": null,
|
||||||
|
"unban_request": null,
|
||||||
|
"unmod": {
|
||||||
|
"user_id": "22484632",
|
||||||
|
"user_login": "forsen",
|
||||||
|
"user_name": "forsen"
|
||||||
|
},
|
||||||
|
"unraid": null,
|
||||||
|
"untimeout": null,
|
||||||
|
"unvip": null,
|
||||||
|
"vip": null,
|
||||||
|
"warn": null
|
||||||
|
},
|
||||||
|
"output": [
|
||||||
|
{
|
||||||
|
"badgeInfos": {
|
||||||
|
},
|
||||||
|
"badges": [
|
||||||
|
],
|
||||||
|
"channelName": "",
|
||||||
|
"count": 1,
|
||||||
|
"displayName": "",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"element": {
|
||||||
|
"color": "System",
|
||||||
|
"flags": "Timestamp",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "TextElement",
|
||||||
|
"words": [
|
||||||
|
"12:31"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"flags": "Timestamp",
|
||||||
|
"format": "",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"time": "12:31:47",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "TimestampElement"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "Text",
|
||||||
|
"fallbackColor": "System",
|
||||||
|
"flags": "Text|Mention",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "MentionElement",
|
||||||
|
"userColor": "System",
|
||||||
|
"userLoginName": "uint128",
|
||||||
|
"words": [
|
||||||
|
"uint128"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "System",
|
||||||
|
"flags": "Text",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "TextElement",
|
||||||
|
"words": [
|
||||||
|
"unmodded"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "Text",
|
||||||
|
"fallbackColor": "System",
|
||||||
|
"flags": "Text|Mention",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": false,
|
||||||
|
"type": "MentionElement",
|
||||||
|
"userColor": "System",
|
||||||
|
"userLoginName": "forsen",
|
||||||
|
"words": [
|
||||||
|
"forsen"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "System",
|
||||||
|
"flags": "Text",
|
||||||
|
"link": {
|
||||||
|
"type": "None",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": "ChatMedium",
|
||||||
|
"tooltip": "",
|
||||||
|
"trailingSpace": true,
|
||||||
|
"type": "TextElement",
|
||||||
|
"words": [
|
||||||
|
"."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"flags": "System|Timeout|EventSub",
|
||||||
|
"id": "",
|
||||||
|
"localizedName": "",
|
||||||
|
"loginName": "uint128",
|
||||||
|
"messageText": "uint128 unmodded forsen. ",
|
||||||
|
"searchText": "uint128 unmodded forsen. ",
|
||||||
|
"serverReceivedTime": "2024-05-14T12:31:47Z",
|
||||||
|
"timeoutUser": "",
|
||||||
|
"userID": "",
|
||||||
|
"usernameColor": "#ff000000"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user