feat: stack /clear messages (#5806)
This commit is contained in:
@@ -0,0 +1,270 @@
|
||||
{
|
||||
"input": "@tmi-sent-ts=1736678514028;room-id=11148817;badges=;badge-info=;flags=;user-type=;emotes= :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"output": [
|
||||
{
|
||||
"badgeInfos": {
|
||||
},
|
||||
"badges": [
|
||||
],
|
||||
"channelName": "",
|
||||
"count": 4,
|
||||
"displayName": "",
|
||||
"elements": [
|
||||
{
|
||||
"element": {
|
||||
"color": "System",
|
||||
"flags": "Timestamp",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"10:41"
|
||||
]
|
||||
},
|
||||
"flags": "Timestamp",
|
||||
"format": "",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"time": "10:41:54",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TimestampElement"
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"Chat",
|
||||
"has",
|
||||
"been",
|
||||
"cleared",
|
||||
"by",
|
||||
"a",
|
||||
"moderator."
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"(4",
|
||||
"times)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"flags": "System|DoNotTriggerNotification|ClearChat",
|
||||
"id": "",
|
||||
"localizedName": "",
|
||||
"loginName": "",
|
||||
"messageText": "Chat has been cleared by a moderator. (4 times) ",
|
||||
"searchText": "Chat has been cleared by a moderator. (4 times) ",
|
||||
"serverReceivedTime": "",
|
||||
"timeoutUser": "",
|
||||
"usernameColor": "#ff000000"
|
||||
},
|
||||
{
|
||||
"badgeInfos": {
|
||||
"subscriber": "108"
|
||||
},
|
||||
"badges": [
|
||||
"broadcaster",
|
||||
"subscriber",
|
||||
"partner"
|
||||
],
|
||||
"channelName": "pajlada",
|
||||
"count": 1,
|
||||
"displayName": "pajlada",
|
||||
"elements": [
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "ChannelName",
|
||||
"link": {
|
||||
"type": "JumpToChannel",
|
||||
"value": "pajlada"
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"#pajlada"
|
||||
]
|
||||
},
|
||||
{
|
||||
"element": {
|
||||
"color": "System",
|
||||
"flags": "Timestamp",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"10:41"
|
||||
]
|
||||
},
|
||||
"flags": "Timestamp",
|
||||
"format": "",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"time": "10:41:52",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TimestampElement"
|
||||
},
|
||||
{
|
||||
"emote": {
|
||||
"images": {
|
||||
"1x": "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/1",
|
||||
"2x": "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/2",
|
||||
"3x": "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/3"
|
||||
},
|
||||
"name": "",
|
||||
"tooltip": "Broadcaster"
|
||||
},
|
||||
"flags": "BadgeChannelAuthority",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"tooltip": "Broadcaster",
|
||||
"trailingSpace": true,
|
||||
"type": "BadgeElement"
|
||||
},
|
||||
{
|
||||
"emote": {
|
||||
"images": {
|
||||
"1x": "https://chatterino.com/tb-1",
|
||||
"2x": "https://chatterino.com/tb-2",
|
||||
"3x": "https://chatterino.com/tb-3"
|
||||
},
|
||||
"name": "",
|
||||
"tooltip": "Subscriber"
|
||||
},
|
||||
"flags": "BadgeSubscription",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"tooltip": "Subscriber (Tier 3, 108 months)",
|
||||
"trailingSpace": true,
|
||||
"type": "BadgeElement"
|
||||
},
|
||||
{
|
||||
"emote": {
|
||||
"homePage": "https://blog.twitch.tv/2017/04/24/the-verified-badge-is-here-13381bc05735",
|
||||
"images": {
|
||||
"1x": "https://static-cdn.jtvnw.net/badges/v1/d12a2e27-16f6-41d0-ab77-b780518f00a3/1",
|
||||
"2x": "https://static-cdn.jtvnw.net/badges/v1/d12a2e27-16f6-41d0-ab77-b780518f00a3/2",
|
||||
"3x": "https://static-cdn.jtvnw.net/badges/v1/d12a2e27-16f6-41d0-ab77-b780518f00a3/3"
|
||||
},
|
||||
"name": "",
|
||||
"tooltip": "Verified"
|
||||
},
|
||||
"flags": "BadgeVanity",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"tooltip": "Verified",
|
||||
"trailingSpace": true,
|
||||
"type": "BadgeElement"
|
||||
},
|
||||
{
|
||||
"color": "#ffcc44ff",
|
||||
"flags": "Username",
|
||||
"link": {
|
||||
"type": "UserInfo",
|
||||
"value": "pajlada"
|
||||
},
|
||||
"style": "ChatMediumBold",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"pajlada:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": "Text",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"asd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"background": "#ffa0a0a4",
|
||||
"flags": "ReplyButton",
|
||||
"link": {
|
||||
"type": "ReplyToMessage",
|
||||
"value": "b4f3ac1d-6335-4567-bb8d-e76dfd83f7e3"
|
||||
},
|
||||
"padding": 2,
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "CircularImageElement",
|
||||
"url": ""
|
||||
}
|
||||
],
|
||||
"flags": "Collapsed",
|
||||
"id": "b4f3ac1d-6335-4567-bb8d-e76dfd83f7e3",
|
||||
"localizedName": "",
|
||||
"loginName": "pajlada",
|
||||
"messageText": "asd",
|
||||
"searchText": "pajlada pajlada: asd ",
|
||||
"serverReceivedTime": "2025-01-12T10:41:52Z",
|
||||
"timeoutUser": "",
|
||||
"usernameColor": "#ffcc44ff"
|
||||
}
|
||||
],
|
||||
"params": {
|
||||
"nAdditional": 2,
|
||||
"prevMessages": [
|
||||
"@tmi-sent-ts=1736678508224;room-id=11148817;badges=;badge-info=;flags=;user-type=;emotes= :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"@tmi-sent-ts=1736678509397;room-id=11148817;badges=;badge-info=;flags=;user-type=;emotes= :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"@tmi-sent-ts=1736678511185;room-id=11148817;badges=;badge-info=;flags=;user-type=;emotes= :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"@tmi-sent-ts=1736678512806;subscriber=1;id=b4f3ac1d-6335-4567-bb8d-e76dfd83f7e3;room-id=11148817;user-id=11148817;display-name=pajlada;badges=broadcaster/1,subscriber/3072,partner/1;badge-info=subscriber/108;color=#CC44FF;flags=;user-type=;emotes= :pajlada!pajlada@pajlada.tmi.twitch.tv PRIVMSG #pajlada :asd"
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"moderation": {
|
||||
"timeoutStackStyle": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"input": "@tmi-sent-ts=1736369068441;rm-received-ts=1736369068532;historical=1;room-id=111448817 :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"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": [
|
||||
"20:44"
|
||||
]
|
||||
},
|
||||
"flags": "Timestamp",
|
||||
"format": "",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"time": "20:44:28",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TimestampElement"
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"Chat",
|
||||
"has",
|
||||
"been",
|
||||
"cleared",
|
||||
"by",
|
||||
"a",
|
||||
"moderator."
|
||||
]
|
||||
}
|
||||
],
|
||||
"flags": "System|DoNotTriggerNotification|ClearChat",
|
||||
"id": "",
|
||||
"localizedName": "",
|
||||
"loginName": "",
|
||||
"messageText": "Chat has been cleared by a moderator. ",
|
||||
"searchText": "Chat has been cleared by a moderator. ",
|
||||
"serverReceivedTime": "",
|
||||
"timeoutUser": "",
|
||||
"usernameColor": "#ff000000"
|
||||
}
|
||||
],
|
||||
"params": {
|
||||
"prevMessages": [
|
||||
"@room-id=111448817;rm-received-ts=1736369059298;rm-deleted=1;tmi-sent-ts=1736369059196;historical=1 :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"@historical=1;tmi-sent-ts=1736369062841;room-id=111448817;rm-received-ts=1736369062932;rm-deleted=1 :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"@room-id=111448817;rm-deleted=1;returning-chatter=0;rm-received-ts=1736369064768;subscriber=0;tmi-sent-ts=1736369064631;color=#FF0000;flags=;turbo=0;user-type=;emotes=;id=50e33ac9-4e54-4503-9a35-a621ef114b82;mod=0;historical=1;user-id=129546453;first-msg=0;badge-info=;badges=broadcaster/1;display-name=nerixyz :nerixyz!nerixyz@nerixyz.tmi.twitch.tv PRIVMSG #pajlada def",
|
||||
"@historical=1;room-id=111448817;rm-received-ts=1736369067491;rm-deleted=1;tmi-sent-ts=1736369067400 :tmi.twitch.tv CLEARCHAT #pajlada"
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"moderation": {
|
||||
"timeoutStackStyle": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"input": "@tmi-sent-ts=1736369068441;rm-received-ts=1736369068532;historical=1;room-id=111448817 :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"output": [
|
||||
{
|
||||
"badgeInfos": {
|
||||
},
|
||||
"badges": [
|
||||
],
|
||||
"channelName": "",
|
||||
"count": 2,
|
||||
"displayName": "",
|
||||
"elements": [
|
||||
{
|
||||
"element": {
|
||||
"color": "System",
|
||||
"flags": "Timestamp",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"20:44"
|
||||
]
|
||||
},
|
||||
"flags": "Timestamp",
|
||||
"format": "",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"time": "20:44:28",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TimestampElement"
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"Chat",
|
||||
"has",
|
||||
"been",
|
||||
"cleared",
|
||||
"by",
|
||||
"a",
|
||||
"moderator."
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"(2",
|
||||
"times)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"flags": "System|DoNotTriggerNotification|ClearChat",
|
||||
"id": "",
|
||||
"localizedName": "",
|
||||
"loginName": "",
|
||||
"messageText": "Chat has been cleared by a moderator. (2 times) ",
|
||||
"searchText": "Chat has been cleared by a moderator. (2 times) ",
|
||||
"serverReceivedTime": "",
|
||||
"timeoutUser": "",
|
||||
"usernameColor": "#ff000000"
|
||||
}
|
||||
],
|
||||
"params": {
|
||||
"nAdditional": 1,
|
||||
"prevMessages": [
|
||||
"@room-id=111448817;rm-received-ts=1736369059298;rm-deleted=1;tmi-sent-ts=1736369059196;historical=1 :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"@historical=1;tmi-sent-ts=1736369062841;room-id=111448817;rm-received-ts=1736369062932;rm-deleted=1 :tmi.twitch.tv CLEARCHAT #pajlada",
|
||||
"@room-id=111448817;rm-deleted=1;returning-chatter=0;rm-received-ts=1736369064768;subscriber=0;tmi-sent-ts=1736369064631;color=#FF0000;flags=;turbo=0;user-type=;emotes=;id=50e33ac9-4e54-4503-9a35-a621ef114b82;mod=0;historical=1;user-id=129546453;first-msg=0;badge-info=;badges=broadcaster/1;display-name=nerixyz :nerixyz!nerixyz@nerixyz.tmi.twitch.tv PRIVMSG #pajlada def",
|
||||
"@historical=1;room-id=111448817;rm-received-ts=1736369067491;rm-deleted=1;tmi-sent-ts=1736369067400 :tmi.twitch.tv CLEARCHAT #pajlada"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -49,106 +49,22 @@
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"Chat"
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"has"
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"been"
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"cleared"
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"by"
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"a"
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": "System",
|
||||
"flags": "Text",
|
||||
"link": {
|
||||
"type": "None",
|
||||
"value": ""
|
||||
},
|
||||
"style": "ChatMedium",
|
||||
"tooltip": "",
|
||||
"trailingSpace": true,
|
||||
"type": "TextElement",
|
||||
"words": [
|
||||
"Chat",
|
||||
"has",
|
||||
"been",
|
||||
"cleared",
|
||||
"by",
|
||||
"a",
|
||||
"moderator."
|
||||
]
|
||||
}
|
||||
],
|
||||
"flags": "System|DoNotTriggerNotification",
|
||||
"flags": "System|DoNotTriggerNotification|ClearChat",
|
||||
"id": "",
|
||||
"localizedName": "",
|
||||
"loginName": "",
|
||||
"messageText": "Chat has been cleared by a moderator.",
|
||||
"searchText": "Chat has been cleared by a moderator.",
|
||||
"messageText": "Chat has been cleared by a moderator. ",
|
||||
"searchText": "Chat has been cleared by a moderator. ",
|
||||
"serverReceivedTime": "",
|
||||
"timeoutUser": "",
|
||||
"usernameColor": "#ff000000"
|
||||
|
||||
@@ -569,6 +569,7 @@ public:
|
||||
/// - `prevMessages`: An array of past messages (used for replies)
|
||||
/// - `findAllUsernames`: A boolean controlling the equally named setting
|
||||
/// (default: false)
|
||||
/// - `nAdditional`: Include n additional built messages (from `prevMessages`)
|
||||
TEST_P(TestIrcMessageHandlerP, Run)
|
||||
{
|
||||
auto channel = makeMockTwitchChannel(u"pajlada"_s, *snapshot);
|
||||
@@ -588,7 +589,10 @@ TEST_P(TestIrcMessageHandlerP, Run)
|
||||
Communi::IrcMessage::fromData(snapshot->inputUtf8(), nullptr);
|
||||
ASSERT_NE(ircMessage, nullptr);
|
||||
|
||||
auto firstAddedMsg = sink.messages().size();
|
||||
auto nAdditionalMessages = snapshot->param("nAdditional").toInt(0);
|
||||
ASSERT_GE(sink.messages().size(), nAdditionalMessages);
|
||||
|
||||
auto firstAddedMsg = sink.messages().size() - nAdditionalMessages;
|
||||
IrcMessageHandler::parseMessageInto(ircMessage, sink, channel.get());
|
||||
|
||||
QJsonArray got;
|
||||
|
||||
Reference in New Issue
Block a user