-
-
Notifications
You must be signed in to change notification settings - Fork 518
Add support for plugin links #6386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@Nerixyz I'd like your review on this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, would be nice with a test for this functionality showing some example usages
The tooltip data is now ignored when using links. I can't mark your comment as resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested this yet but the code looks fine except the clang-tidy suggestion.
From testing:
Testc2.register_command("/links", function(ctx)
local chan = ctx.channel
chan:add_message(c2.Message.new({
id = "testing42",
elements = { { type = "text", text = "testing" } },
}))
local lb = { type = "linebreak", flags = c2.MessageElementFlag.Text };
chan:add_message(c2.Message.new({
elements = {
{
type = "text",
text = "Text Element",
link = { type = c2.LinkType.Url, value = "https://twitch.com/forsen" },
},
{
type = "single-line-text",
text = "single-line-text",
link = { type = c2.LinkType.UserInfo, value = "id:141981764" },
},
{
type = "mention",
display_name = "display_name[Mention]",
login_name = "twitchdev",
user_color = "link",
fallback_color = "link",
},
{
type = "timestamp",
link = { type = c2.LinkType.JumpToChannel, value = "twitchdev" }
},
lb,
{
type = "reply-curve",
link = { type = c2.LinkType.CopyToClipboard, value = "hello world" }
},
{
type = "text",
text = "some text",
}
}
}))
chan:add_message(c2.Message.new({
flags = c2.MessageFlag.Centered,
elements = {
{
type = "text",
text = "Available Links",
style = c2.FontStyle.ChatVeryLarge,
},
lb,
{
type = "text",
text = "JumpToChannel",
link = { type = c2.LinkType.JumpToChannel, value = "twitchdev" },
},
lb,
{
type = "text",
text = "JumpToMessage",
link = { type = c2.LinkType.JumpToMessage, value = "testing42" },
},
lb,
{
type = "text",
text = "CopyToClipboard",
link = { type = c2.LinkType.CopyToClipboard, value = "Hello, World!" },
},
lb,
{
type = "text",
text = "Url",
link = { type = c2.LinkType.Url, value = "https://example.com" },
},
lb,
{
type = "text",
text = "UserAction",
link = { type = c2.LinkType.UserAction, value = "My user action" },
},
lb,
{
type = "text",
text = "UserInfo",
link = { type = c2.LinkType.UserInfo, value = "twitchdev" },
}
}
}))
end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine for me now.
…re/plugin-message-construction-link
This reverts commit d28b859.
@pajlada I have re-broken reply-curves, they now should render the same as before. |
60872f4
to
995bf0b
Compare
@pajlada could you review this when you have time? |
I'll start taking a look at these leftover PRs this weekend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just fix the changelog entry and you can merge this in
- Minor: Allow for themes to set transparent values for window background on Linux. (#6137) | ||
- Minor: Popup overlay now only draws an outline when being interacted with. (#6140) | ||
- Minor: Added basic message API to plugins. (#5754) | ||
- Minor: Added basic message API to plugins. (#5754, #6386) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix the changelog entry (move it to the right place)
Gives plugins the ability to add links to message elements