feat(eventsub): implement automod message hold (#6005)

This commit is contained in:
nerix
2025-03-01 08:32:50 +01:00
committed by GitHub
parent 95b97f42e6
commit 8f1f07d672
17 changed files with 1769 additions and 19 deletions
@@ -0,0 +1,257 @@
{
"input": {
"automod": {
"boundaries": [
{
"end_pos": 2,
"start_pos": 0
}
],
"category": "swearing",
"level": 4
},
"blocked_term": null,
"broadcaster_user_id": "11148817",
"broadcaster_user_login": "pajlada",
"broadcaster_user_name": "pajlada",
"held_at": "2025-02-28T16:15:15.008668809Z",
"message": {
"fragments": [
{
"cheermote": null,
"emote": null,
"text": "ass",
"type": "text"
}
],
"text": "ass"
},
"message_id": "19d067ff-89b5-4790-a720-97599894eb6b",
"reason": "automod",
"user_id": "129546453",
"user_login": "nerixyz",
"user_name": "nerixyz"
},
"output": [
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"elements": [
{
"emote": {
"homePage": "https://dashboard.twitch.tv/settings/moderation/automod",
"images": {
"1x": ""
},
"name": "",
"tooltip": "AutoMod"
},
"flags": "BadgeChannelAuthority",
"link": {
"type": "None",
"value": ""
},
"tooltip": "AutoMod",
"trailingSpace": true,
"type": "BadgeElement"
},
{
"color": "#ff0000ff",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"AutoMod:"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Held",
"a",
"message",
"for",
"reason:",
"swearing",
"level",
"4.",
"Allow",
"will",
"post",
"it",
"in",
"chat.",
""
]
},
{
"color": "#ff00ff00",
"flags": "Text",
"link": {
"type": "AutoModAllow",
"value": "19d067ff-89b5-4790-a720-97599894eb6b"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Allow"
]
},
{
"color": "#ffff0000",
"flags": "Text",
"link": {
"type": "AutoModDeny",
"value": "19d067ff-89b5-4790-a720-97599894eb6b"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"",
"Deny"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessageHeader|EventSub",
"id": "automod_19d067ff-89b5-4790-a720-97599894eb6b",
"localizedName": "",
"loginName": "automod",
"messageText": "AutoMod: Held a message for reason: swearing level 4. Allow will post it in chat. Allow Deny",
"searchText": "AutoMod: Held a message for reason: swearing level 4. Allow will post it in chat. Allow Deny",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
},
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"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": [
"12:31"
]
},
"flags": "Timestamp",
"format": "",
"link": {
"type": "None",
"value": ""
},
"time": "12:31:47",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
},
{
"flags": "ModeratorTools",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "TwitchModerationElement"
},
{
"color": "Text",
"fallbackColor": "Text",
"flags": "Text|Mention",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "MentionElement",
"userColor": "Text",
"userLoginName": "nerixyz",
"words": [
"nerixyz:"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"ass"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessage|EventSub",
"id": "",
"localizedName": "",
"loginName": "nerixyz",
"messageText": "nerixyz: ass",
"searchText": "nerixyz: ass",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
]
}
@@ -0,0 +1,271 @@
{
"input": {
"automod": null,
"blocked_term": {
"terms_found": [
{
"boundary": {
"end_pos": 18,
"start_pos": 4
},
"owner_broadcaster_user_id": "489584266",
"owner_broadcaster_user_login": "uint128",
"owner_broadcaster_user_name": "uint128",
"term_id": "1a79a074-4aaf-4d84-ac87-eba0a65b9a26"
}
]
},
"broadcaster_user_id": "11148817",
"broadcaster_user_login": "pajlada",
"broadcaster_user_name": "pajlada",
"held_at": "2025-02-28T15:56:05.608943282Z",
"message": {
"fragments": [
{
"cheermote": null,
"emote": null,
"text": "😂 😂 ",
"type": "text"
},
{
"cheermote": null,
"emote": null,
"text": "🍋‍🟩blockedterm😂",
"type": "text"
}
],
"text": "😂 😂 🍋‍🟩blockedterm😂"
},
"message_id": "0cbb6e48-1606-46c6-b1ac-c97626e1c5cb",
"reason": "blocked_term",
"user_id": "129546453",
"user_login": "nerixyz",
"user_name": "nerixyz"
},
"output": [
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"elements": [
{
"emote": {
"homePage": "https://dashboard.twitch.tv/settings/moderation/automod",
"images": {
"1x": ""
},
"name": "",
"tooltip": "AutoMod"
},
"flags": "BadgeChannelAuthority",
"link": {
"type": "None",
"value": ""
},
"tooltip": "AutoMod",
"trailingSpace": true,
"type": "BadgeElement"
},
{
"color": "#ff0000ff",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"AutoMod:"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Held",
"a",
"message",
"for",
"reason:",
"matches",
"1",
"blocked",
"term",
"\"🍋‍🟩blockedterm😂\".",
"Allow",
"will",
"post",
"it",
"in",
"chat.",
""
]
},
{
"color": "#ff00ff00",
"flags": "Text",
"link": {
"type": "AutoModAllow",
"value": "0cbb6e48-1606-46c6-b1ac-c97626e1c5cb"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Allow"
]
},
{
"color": "#ffff0000",
"flags": "Text",
"link": {
"type": "AutoModDeny",
"value": "0cbb6e48-1606-46c6-b1ac-c97626e1c5cb"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"",
"Deny"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessageHeader|AutoModBlockedTerm|EventSub",
"id": "automod_0cbb6e48-1606-46c6-b1ac-c97626e1c5cb",
"localizedName": "",
"loginName": "automod",
"messageText": "AutoMod: Held a message for reason: matches 1 blocked term \"🍋‍🟩blockedterm😂\". Allow will post it in chat. Allow Deny",
"searchText": "AutoMod: Held a message for reason: matches 1 blocked term \"🍋‍🟩blockedterm😂\". Allow will post it in chat. Allow Deny",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
},
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"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": [
"12:31"
]
},
"flags": "Timestamp",
"format": "",
"link": {
"type": "None",
"value": ""
},
"time": "12:31:47",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
},
{
"flags": "ModeratorTools",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "TwitchModerationElement"
},
{
"color": "Text",
"fallbackColor": "Text",
"flags": "Text|Mention",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "MentionElement",
"userColor": "Text",
"userLoginName": "nerixyz",
"words": [
"nerixyz:"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"😂",
"😂",
"🍋‍🟩blockedterm😂"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessage|AutoModBlockedTerm|EventSub",
"id": "",
"localizedName": "",
"loginName": "nerixyz",
"messageText": "nerixyz: 😂 😂 🍋‍🟩blockedterm😂",
"searchText": "nerixyz: 😂 😂 🍋‍🟩blockedterm😂",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
]
}
@@ -0,0 +1,263 @@
{
"input": {
"automod": null,
"blocked_term": {
"terms_found": [
{
"boundary": {
"end_pos": 10,
"start_pos": 0
},
"owner_broadcaster_user_id": "489584266",
"owner_broadcaster_user_login": "uint128",
"owner_broadcaster_user_name": "uint128",
"term_id": "1a79a074-4aaf-4d84-ac87-eba0a65b9a26"
}
]
},
"broadcaster_user_id": "11148817",
"broadcaster_user_login": "pajlada",
"broadcaster_user_name": "pajlada",
"held_at": "2025-02-28T15:55:41.953497979Z",
"message": {
"fragments": [
{
"cheermote": null,
"emote": null,
"text": "blockedterm",
"type": "text"
}
],
"text": "blockedterm"
},
"message_id": "c0fac418-25a9-41b8-adf3-5bd637fca1e1",
"reason": "blocked_term",
"user_id": "129546453",
"user_login": "nerixyz",
"user_name": "nerixyz"
},
"output": [
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"elements": [
{
"emote": {
"homePage": "https://dashboard.twitch.tv/settings/moderation/automod",
"images": {
"1x": ""
},
"name": "",
"tooltip": "AutoMod"
},
"flags": "BadgeChannelAuthority",
"link": {
"type": "None",
"value": ""
},
"tooltip": "AutoMod",
"trailingSpace": true,
"type": "BadgeElement"
},
{
"color": "#ff0000ff",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"AutoMod:"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Held",
"a",
"message",
"for",
"reason:",
"matches",
"1",
"blocked",
"term",
"\"blockedterm\".",
"Allow",
"will",
"post",
"it",
"in",
"chat.",
""
]
},
{
"color": "#ff00ff00",
"flags": "Text",
"link": {
"type": "AutoModAllow",
"value": "c0fac418-25a9-41b8-adf3-5bd637fca1e1"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Allow"
]
},
{
"color": "#ffff0000",
"flags": "Text",
"link": {
"type": "AutoModDeny",
"value": "c0fac418-25a9-41b8-adf3-5bd637fca1e1"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"",
"Deny"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessageHeader|AutoModBlockedTerm|EventSub",
"id": "automod_c0fac418-25a9-41b8-adf3-5bd637fca1e1",
"localizedName": "",
"loginName": "automod",
"messageText": "AutoMod: Held a message for reason: matches 1 blocked term \"blockedterm\". Allow will post it in chat. Allow Deny",
"searchText": "AutoMod: Held a message for reason: matches 1 blocked term \"blockedterm\". Allow will post it in chat. Allow Deny",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
},
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"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": [
"12:31"
]
},
"flags": "Timestamp",
"format": "",
"link": {
"type": "None",
"value": ""
},
"time": "12:31:47",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
},
{
"flags": "ModeratorTools",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "TwitchModerationElement"
},
{
"color": "Text",
"fallbackColor": "Text",
"flags": "Text|Mention",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "MentionElement",
"userColor": "Text",
"userLoginName": "nerixyz",
"words": [
"nerixyz:"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"blockedterm"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessage|AutoModBlockedTerm|EventSub",
"id": "",
"localizedName": "",
"loginName": "nerixyz",
"messageText": "nerixyz: blockedterm",
"searchText": "nerixyz: blockedterm",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
]
}
@@ -0,0 +1,321 @@
{
"input": {
"automod": null,
"blocked_term": {
"terms_found": [
{
"boundary": {
"end_pos": 7,
"start_pos": 5
},
"owner_broadcaster_user_id": "489584266",
"owner_broadcaster_user_login": "uint128",
"owner_broadcaster_user_name": "uint128",
"term_id": "b48d9032-5033-4598-9650-da7a1e4b1f4c"
},
{
"boundary": {
"end_pos": 19,
"start_pos": 9
},
"owner_broadcaster_user_id": "489584266",
"owner_broadcaster_user_login": "uint128",
"owner_broadcaster_user_name": "uint128",
"term_id": "1a79a074-4aaf-4d84-ac87-eba0a65b9a26"
},
{
"boundary": {
"end_pos": 23,
"start_pos": 23
},
"owner_broadcaster_user_id": "489584266",
"owner_broadcaster_user_login": "uint128",
"owner_broadcaster_user_name": "uint128",
"term_id": "84b1f858-7170-4c33-be4c-97612dde8e10"
}
]
},
"broadcaster_user_id": "11148817",
"broadcaster_user_login": "pajlada",
"broadcaster_user_name": "pajlada",
"held_at": "2025-02-28T16:14:38.089369252Z",
"message": {
"fragments": [
{
"cheermote": null,
"emote": null,
"text": "😂 😂 ",
"type": "text"
},
{
"cheermote": null,
"emote": null,
"text": "🍋‍🟩",
"type": "text"
},
{
"cheermote": null,
"emote": null,
"text": " ",
"type": "text"
},
{
"cheermote": null,
"emote": null,
"text": "blockedterm",
"type": "text"
},
{
"cheermote": null,
"emote": null,
"text": " 😂 ",
"type": "text"
},
{
"cheermote": null,
"emote": null,
"text": "🍩",
"type": "text"
}
],
"text": "😂 😂 🍋‍🟩 blockedterm 😂 🍩"
},
"message_id": "45a63ca1-1b0c-46ef-9075-d112f9a9f376",
"reason": "blocked_term",
"user_id": "129546453",
"user_login": "nerixyz",
"user_name": "nerixyz"
},
"output": [
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"elements": [
{
"emote": {
"homePage": "https://dashboard.twitch.tv/settings/moderation/automod",
"images": {
"1x": ""
},
"name": "",
"tooltip": "AutoMod"
},
"flags": "BadgeChannelAuthority",
"link": {
"type": "None",
"value": ""
},
"tooltip": "AutoMod",
"trailingSpace": true,
"type": "BadgeElement"
},
{
"color": "#ff0000ff",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"AutoMod:"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Held",
"a",
"message",
"for",
"reason:",
"matches",
"3",
"blocked",
"terms",
"\"🍋‍🟩\",",
"\"blockedterm\",",
"\"🍩\".",
"Allow",
"will",
"post",
"it",
"in",
"chat.",
""
]
},
{
"color": "#ff00ff00",
"flags": "Text",
"link": {
"type": "AutoModAllow",
"value": "45a63ca1-1b0c-46ef-9075-d112f9a9f376"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Allow"
]
},
{
"color": "#ffff0000",
"flags": "Text",
"link": {
"type": "AutoModDeny",
"value": "45a63ca1-1b0c-46ef-9075-d112f9a9f376"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"",
"Deny"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessageHeader|AutoModBlockedTerm|EventSub",
"id": "automod_45a63ca1-1b0c-46ef-9075-d112f9a9f376",
"localizedName": "",
"loginName": "automod",
"messageText": "AutoMod: Held a message for reason: matches 3 blocked terms \"🍋‍🟩\", \"blockedterm\", \"🍩\". Allow will post it in chat. Allow Deny",
"searchText": "AutoMod: Held a message for reason: matches 3 blocked terms \"🍋‍🟩\", \"blockedterm\", \"🍩\". Allow will post it in chat. Allow Deny",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
},
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"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": [
"12:31"
]
},
"flags": "Timestamp",
"format": "",
"link": {
"type": "None",
"value": ""
},
"time": "12:31:47",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
},
{
"flags": "ModeratorTools",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "TwitchModerationElement"
},
{
"color": "Text",
"fallbackColor": "Text",
"flags": "Text|Mention",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "MentionElement",
"userColor": "Text",
"userLoginName": "nerixyz",
"words": [
"nerixyz:"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"😂",
"",
"😂",
"🍋‍🟩",
"blockedterm",
"😂",
"🍩"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessage|AutoModBlockedTerm|EventSub",
"id": "",
"localizedName": "",
"loginName": "nerixyz",
"messageText": "nerixyz: 😂 😂 🍋‍🟩 blockedterm 😂 🍩",
"searchText": "nerixyz: 😂 😂 🍋‍🟩 blockedterm 😂 🍩",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
]
}
@@ -0,0 +1,257 @@
{
"input": {
"automod": {
"boundaries": [
{
"end_pos": 2,
"start_pos": 0
}
],
"category": "swearing",
"level": 4
},
"blocked_term": null,
"broadcaster_user_id": "11148817",
"broadcaster_user_login": "pajlada",
"broadcaster_user_name": "pajlada",
"held_at": "2025-02-28T16:15:15.008668809Z",
"message": {
"fragments": [
{
"cheermote": null,
"emote": null,
"text": "ass",
"type": "text"
}
],
"text": "ass"
},
"message_id": "19d067ff-89b5-4790-a720-97599894eb6b",
"reason": "automod",
"user_id": "117166826",
"user_login": "testaccount_420",
"user_name": "테스트계정420"
},
"output": [
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"elements": [
{
"emote": {
"homePage": "https://dashboard.twitch.tv/settings/moderation/automod",
"images": {
"1x": ""
},
"name": "",
"tooltip": "AutoMod"
},
"flags": "BadgeChannelAuthority",
"link": {
"type": "None",
"value": ""
},
"tooltip": "AutoMod",
"trailingSpace": true,
"type": "BadgeElement"
},
{
"color": "#ff0000ff",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"AutoMod:"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Held",
"a",
"message",
"for",
"reason:",
"swearing",
"level",
"4.",
"Allow",
"will",
"post",
"it",
"in",
"chat.",
""
]
},
{
"color": "#ff00ff00",
"flags": "Text",
"link": {
"type": "AutoModAllow",
"value": "19d067ff-89b5-4790-a720-97599894eb6b"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"Allow"
]
},
{
"color": "#ffff0000",
"flags": "Text",
"link": {
"type": "AutoModDeny",
"value": "19d067ff-89b5-4790-a720-97599894eb6b"
},
"style": "ChatMediumBold",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"",
"Deny"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessageHeader|EventSub",
"id": "automod_19d067ff-89b5-4790-a720-97599894eb6b",
"localizedName": "",
"loginName": "automod",
"messageText": "AutoMod: Held a message for reason: swearing level 4. Allow will post it in chat. Allow Deny",
"searchText": "AutoMod: Held a message for reason: swearing level 4. Allow will post it in chat. Allow Deny",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
},
{
"badgeInfos": {
},
"badges": [
],
"channelName": "pajlada",
"count": 1,
"displayName": "",
"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": [
"12:31"
]
},
"flags": "Timestamp",
"format": "",
"link": {
"type": "None",
"value": ""
},
"time": "12:31:47",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
},
{
"flags": "ModeratorTools",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "TwitchModerationElement"
},
{
"color": "Text",
"fallbackColor": "Text",
"flags": "Text|Mention",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "MentionElement",
"userColor": "Text",
"userLoginName": "testaccount_420",
"words": [
"testaccount_420(테스트계정420):"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"ass"
]
}
],
"flags": "Timeout|PubSub|AutoMod|AutoModOffendingMessage|EventSub",
"id": "",
"localizedName": "",
"loginName": "testaccount_420",
"messageText": "testaccount_420(테스트계정420): ass",
"searchText": "testaccount_420(테스트계정420): ass",
"serverReceivedTime": "2024-05-14T12:31:47Z",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
]
}
+30 -1
View File
@@ -1,5 +1,6 @@
#include "common/Literals.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/highlights/HighlightController.hpp"
#include "lib/Snapshot.hpp"
#include "messages/Message.hpp"
#include "mocks/BaseApplication.hpp"
@@ -62,12 +63,34 @@ const std::map<QString, std::string_view, QCompareCaseInsensitive>
"cost": 0
})",
},
{
"automod-message-hold",
R"({
"id": "a3122e32-6498-4847-8675-109b9b94f29c",
"status": "enabled",
"type": "automod.message.hold",
"version": "2",
"condition": {
"broadcaster_user_id": "489584266",
"moderator_user_id": "489584266"
},
"transport": {
"method":"websocket",
"session_id":"AgoQ59RRLw0mS6S000QtK8f54BIGY2VsbC1j"
},
"created_at": "2025-02-28T15:55:37.85489173Z",
"cost": 0
})",
},
};
class MockApplication : public mock::BaseApplication
{
public:
MockApplication() = default;
MockApplication()
: highlights(this->settings, &this->accounts)
{
}
ILogging *getChatLogger() override
{
@@ -84,9 +107,15 @@ public:
return &this->accounts;
}
HighlightController *getHighlights() override
{
return &this->highlights;
}
mock::EmptyLogging logging;
mock::MockTwitchIrcServer twitch;
AccountController accounts;
HighlightController highlights;
};
std::shared_ptr<TwitchChannel> makeMockTwitchChannel(const QString &name)
+35
View File
@@ -578,3 +578,38 @@ TEST(Helpers, chronoToQDateTime)
ASSERT_EQ(qPointSinceEpoch.toString(Qt::ISODateWithMs),
"2025-02-26T12:49:49.131Z");
}
TEST(Helpers, codepointSlice)
{
ASSERT_EQ(codepointSlice(u"", 0, 0), u"");
ASSERT_EQ(codepointSlice(u"", 0, 1), u"");
ASSERT_EQ(codepointSlice(u"", 1, 1), u"");
ASSERT_EQ(codepointSlice(u"", -1, 1), u"");
ASSERT_EQ(codepointSlice(u"a", 0, 0), u"");
ASSERT_EQ(codepointSlice(u"a", 0, 1), u"a");
ASSERT_EQ(codepointSlice(u"a", 0, 2), u"");
ASSERT_EQ(codepointSlice(u"a", -1, 1), u"");
ASSERT_EQ(codepointSlice(u"abcd", 1, 3), u"bc");
ASSERT_EQ(codepointSlice(u"abcd", 0, 3), u"abc");
ASSERT_EQ(codepointSlice(u"abcd", 1, 4), u"bcd");
ASSERT_EQ(codepointSlice(u"abcd", 0, 4), u"abcd");
ASSERT_EQ(codepointSlice(u"abcd", 0, 5), u"");
ASSERT_EQ(codepointSlice(u"abcd", 5, 0), u"");
ASSERT_EQ(codepointSlice(u"🍩🍟🥚🍳🌮🍞🌭🥞🍳", 1, 3), u"🍟🥚");
ASSERT_EQ(codepointSlice(u"🍩🍟🥚🍳🌮🍞🌭🥞🍳", 0, 3), u"🍩🍟🥚");
ASSERT_EQ(codepointSlice(u"🍩🍟🥚🍳🌮🍞🌭🥞🍳", 0, 9),
u"🍩🍟🥚🍳🌮🍞🌭🥞🍳");
ASSERT_EQ(codepointSlice(u"🍩🍟🥚🍳🌮🍞🌭🥞🍳", 3, 9), u"🍳🌮🍞🌭🥞🍳");
ASSERT_EQ(codepointSlice(u"🍩🍟🥚🍳🌮🍞🌭🥞🍳", 3, 10), u"");
ASSERT_EQ(codepointSlice(u"🍩🍟🥚🍳🌮🍞🌭🥞🍳", 3, 8), u"🍳🌮🍞🌭🥞");
ASSERT_EQ(codepointSlice(u"🍩🍟🥚🍳🌮🍞🌭🥞🍳", 3, 7), u"🍳🌮🍞🌭");
ASSERT_EQ(codepointSlice(u"🍩🍟🥚🍳🌮🍞🌭🥞🍳", 3, 4), u"🍳");
ASSERT_EQ(codepointSlice(u"🍩🍟\xD83E\xDD5A", 0, 3), u"🍩🍟🥚");
ASSERT_EQ(codepointSlice(u"🍩🍟\xD83E\xDD5A", 0, 4), u"");
ASSERT_EQ(codepointSlice(u"🍩🍟\xD83E", 0, 3), u"🍩🍟\xD83E");
ASSERT_EQ(codepointSlice(u"🍩🍟\xD83E🥚", 0, 4), u"🍩🍟\xD83E🥚");
}