feat(plugins): add basic message construction (#5754)

This commit is contained in:
nerix
2025-07-31 15:36:39 +02:00
committed by GitHub
parent 7e7c4112d7
commit a4478748f7
29 changed files with 2070 additions and 36 deletions
@@ -0,0 +1,24 @@
{
"input": "msg = {}",
"output": {
"badgeInfos": {
},
"badges": [
],
"channelName": "",
"count": 1,
"displayName": "",
"elements": [
],
"flags": "",
"id": "",
"localizedName": "",
"loginName": "",
"messageText": "",
"searchText": "",
"serverReceivedTime": "",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
}
@@ -0,0 +1,71 @@
{
"input": [
"msg = {elements={",
" { type = 'linebreak' },",
" { type = 'linebreak', flags = c2.MessageElementFlag.BttvEmoteImage },",
" { type = 'linebreak', tooltip = 't' },",
" { type = 'linebreak', trailing_space = false },",
"}}"
],
"output": {
"badgeInfos": {
},
"badges": [
],
"channelName": "",
"count": 1,
"displayName": "",
"elements": [
{
"flags": "",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "LinebreakElement"
},
{
"flags": "BttvEmoteImage",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "LinebreakElement"
},
{
"flags": "",
"link": {
"type": "None",
"value": ""
},
"tooltip": "t",
"trailingSpace": true,
"type": "LinebreakElement"
},
{
"flags": "",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": false,
"type": "LinebreakElement"
}
],
"flags": "",
"id": "",
"localizedName": "",
"loginName": "",
"messageText": "",
"searchText": "",
"serverReceivedTime": "",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
}
@@ -0,0 +1,103 @@
{
"input": [
"msg = {elements={",
" { type = 'mention', display_name = 'd', login_name = 'l', fallback_color = 'red', user_color = 'green' },",
" { type = 'mention', display_name = 'd', login_name = 'l', fallback_color = 'red', user_color = 'green', flags = c2.MessageElementFlag.BttvEmote },",
" { type = 'mention', display_name = 'd', login_name = 'l', fallback_color = 'red', user_color = 'green', tooltip = 't' },",
" { type = 'mention', display_name = 'd', login_name = 'l', fallback_color = 'red', user_color = 'green', trailing_space = false },",
"}}"
],
"output": {
"badgeInfos": {
},
"badges": [
],
"channelName": "",
"count": 1,
"displayName": "",
"elements": [
{
"color": "Text",
"fallbackColor": "#ffff0000",
"flags": "Text|Mention",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "MentionElement",
"userColor": "#ff008000",
"userLoginName": "l",
"words": [
"d"
]
},
{
"color": "Text",
"fallbackColor": "#ffff0000",
"flags": "Text|Mention",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "MentionElement",
"userColor": "#ff008000",
"userLoginName": "l",
"words": [
"d"
]
},
{
"color": "Text",
"fallbackColor": "#ffff0000",
"flags": "Text|Mention",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "t",
"trailingSpace": true,
"type": "MentionElement",
"userColor": "#ff008000",
"userLoginName": "l",
"words": [
"d"
]
},
{
"color": "Text",
"fallbackColor": "#ffff0000",
"flags": "Text|Mention",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": false,
"type": "MentionElement",
"userColor": "#ff008000",
"userLoginName": "l",
"words": [
"d"
]
}
],
"flags": "",
"id": "",
"localizedName": "",
"loginName": "",
"messageText": "",
"searchText": "",
"serverReceivedTime": "",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
}
@@ -0,0 +1,60 @@
{
"input": [
"msg = {",
" flags = c2.MessageFlag.System | c2.MessageFlag.Disabled,",
" id = 'foo-bar',",
" parse_time = 420000,",
" search_text = 'search',",
" message_text = 'message',",
" login_name = 'login',",
" display_name = 'display',",
" localized_name = 'local',",
" user_id = 'user-id',",
" username_color = 'blue',",
" server_received_time = 1230000,",
" highlight_color = '#12345678',",
" channel_name = 'channel',",
" elements = {",
" { type = 'text', text = 'aliens walking' }",
" }",
"}"
],
"output": {
"badgeInfos": {
},
"badges": [
],
"channelName": "channel",
"count": 1,
"displayName": "display",
"elements": [
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"aliens",
"walking"
]
}
],
"flags": "System|Disabled",
"highlightColor": "#12345678",
"id": "foo-bar",
"localizedName": "local",
"loginName": "login",
"messageText": "message",
"searchText": "search",
"serverReceivedTime": "1970-01-01T00:20:30Z",
"timeoutUser": "",
"userID": "user-id",
"usernameColor": "#ff0000ff"
}
}
@@ -0,0 +1,71 @@
{
"input": [
"msg = {elements={",
" { type = 'reply-curve' },",
" { type = 'reply-curve', flags = c2.MessageElementFlag.BttvEmote },",
" { type = 'reply-curve', tooltip = 't' },",
" { type = 'reply-curve', trailing_space = false },",
"}}"
],
"output": {
"badgeInfos": {
},
"badges": [
],
"channelName": "",
"count": 1,
"displayName": "",
"elements": [
{
"flags": "RepliedMessage",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "ReplyCurveElement"
},
{
"flags": "RepliedMessage",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "ReplyCurveElement"
},
{
"flags": "RepliedMessage",
"link": {
"type": "None",
"value": ""
},
"tooltip": "t",
"trailingSpace": true,
"type": "ReplyCurveElement"
},
{
"flags": "RepliedMessage",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": false,
"type": "ReplyCurveElement"
}
],
"flags": "",
"id": "",
"localizedName": "",
"loginName": "",
"messageText": "",
"searchText": "",
"serverReceivedTime": "",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
}
@@ -0,0 +1,188 @@
{
"input": [
"msg = {elements={",
" { type = 'single-line-text', text = '' },",
" { type = 'single-line-text', text = 'foo' },",
" { type = 'single-line-text', text = 'foo bar' },",
" { type = 'single-line-text', text = 'foo\\nbar' },",
" { type = 'single-line-text', text = 'foo', flags = c2.MessageElementFlag.Text | c2.MessageElementFlag.Timestamp },",
" { type = 'single-line-text', text = 'foo', color = 'text' },",
" { type = 'single-line-text', text = 'foo', color = 'system' },",
" { type = 'single-line-text', text = 'foo', color = 'link' },",
" { type = 'single-line-text', text = 'foo', color = 'green' },",
" { type = 'single-line-text', text = 'foo', style = c2.FontStyle.ChatSmall },",
"}}"
],
"output": {
"badgeInfos": {
},
"badges": [
],
"channelName": "",
"count": 1,
"displayName": "",
"elements": [
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
""
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
"foo"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
"foo",
"bar"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
"foo\nbar"
]
},
{
"color": "Text",
"flags": "Text|Timestamp",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
"foo"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
"foo"
]
},
{
"color": "System",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
"foo"
]
},
{
"color": "Link",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
"foo"
]
},
{
"color": "#ff008000",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
"foo"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatSmall",
"tooltip": "",
"trailingSpace": true,
"type": "SingleLineTextElement",
"words": [
"foo"
]
}
],
"flags": "",
"id": "",
"localizedName": "",
"loginName": "",
"messageText": "",
"searchText": "",
"serverReceivedTime": "",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
}
@@ -0,0 +1,188 @@
{
"input": [
"msg = {elements={",
" { type = 'text', text = '' },",
" { type = 'text', text = 'foo' },",
" { type = 'text', text = 'foo bar' },",
" { type = 'text', text = 'foo\\nbar' },",
" { type = 'text', text = 'foo', flags = c2.MessageElementFlag.Text | c2.MessageElementFlag.Timestamp },",
" { type = 'text', text = 'foo', color = 'text' },",
" { type = 'text', text = 'foo', color = 'system' },",
" { type = 'text', text = 'foo', color = 'link' },",
" { type = 'text', text = 'foo', color = 'green' },",
" { type = 'text', text = 'foo', style = c2.FontStyle.ChatSmall },",
"}}"
],
"output": {
"badgeInfos": {
},
"badges": [
],
"channelName": "",
"count": 1,
"displayName": "",
"elements": [
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
""
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"foo"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"foo",
"bar"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"foo\nbar"
]
},
{
"color": "Text",
"flags": "Text|Timestamp",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"foo"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"foo"
]
},
{
"color": "System",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"foo"
]
},
{
"color": "Link",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"foo"
]
},
{
"color": "#ff008000",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"foo"
]
},
{
"color": "Text",
"flags": "Text",
"link": {
"type": "None",
"value": ""
},
"style": "ChatSmall",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"foo"
]
}
],
"flags": "",
"id": "",
"localizedName": "",
"loginName": "",
"messageText": "",
"searchText": "",
"serverReceivedTime": "",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
}
@@ -0,0 +1,139 @@
{
"input": [
"msg = {elements={",
" { type = 'timestamp' },",
" { type = 'timestamp', time = 1230000, flags = c2.MessageElementFlag.BttvEmote },",
" { type = 'timestamp', tooltip = 't' },",
" { type = 'timestamp', trailing_space = false },",
"}}"
],
"output": {
"badgeInfos": {
},
"badges": [
],
"channelName": "",
"count": 1,
"displayName": "",
"elements": [
{
"element": {
"color": "System",
"flags": "Timestamp",
"link": {
"type": "None",
"value": ""
},
"style": "TimestampMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"0:00"
]
},
"flags": "Timestamp",
"format": "",
"link": {
"type": "None",
"value": ""
},
"time": "00:00:00",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
},
{
"element": {
"color": "System",
"flags": "Timestamp",
"link": {
"type": "None",
"value": ""
},
"style": "TimestampMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"0:20"
]
},
"flags": "Timestamp",
"format": "",
"link": {
"type": "None",
"value": ""
},
"time": "00:20:30",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
},
{
"element": {
"color": "System",
"flags": "Timestamp",
"link": {
"type": "None",
"value": ""
},
"style": "TimestampMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"0:00"
]
},
"flags": "Timestamp",
"format": "",
"link": {
"type": "None",
"value": ""
},
"time": "00:00:00",
"tooltip": "t",
"trailingSpace": true,
"type": "TimestampElement"
},
{
"element": {
"color": "System",
"flags": "Timestamp",
"link": {
"type": "None",
"value": ""
},
"style": "TimestampMedium",
"tooltip": "",
"trailingSpace": true,
"type": "TextElement",
"words": [
"0:00"
]
},
"flags": "Timestamp",
"format": "",
"link": {
"type": "None",
"value": ""
},
"time": "00:00:00",
"tooltip": "",
"trailingSpace": false,
"type": "TimestampElement"
}
],
"flags": "",
"id": "",
"localizedName": "",
"loginName": "",
"messageText": "",
"searchText": "",
"serverReceivedTime": "",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
}
@@ -0,0 +1,71 @@
{
"input": [
"msg = {elements={",
" { type = 'twitch-moderation' },",
" { type = 'twitch-moderation', flags = c2.MessageElementFlag.BttvEmote },",
" { type = 'twitch-moderation', tooltip = 't' },",
" { type = 'twitch-moderation', trailing_space = false },",
"}}"
],
"output": {
"badgeInfos": {
},
"badges": [
],
"channelName": "",
"count": 1,
"displayName": "",
"elements": [
{
"flags": "ModeratorTools",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "TwitchModerationElement"
},
{
"flags": "ModeratorTools",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": true,
"type": "TwitchModerationElement"
},
{
"flags": "ModeratorTools",
"link": {
"type": "None",
"value": ""
},
"tooltip": "t",
"trailingSpace": true,
"type": "TwitchModerationElement"
},
{
"flags": "ModeratorTools",
"link": {
"type": "None",
"value": ""
},
"tooltip": "",
"trailingSpace": false,
"type": "TwitchModerationElement"
}
],
"flags": "",
"id": "",
"localizedName": "",
"loginName": "",
"messageText": "",
"searchText": "",
"serverReceivedTime": "",
"timeoutUser": "",
"userID": "",
"usernameColor": "#ff000000"
}
}