Add clickable text and hover text #2529
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Method:
sendRawMessage
Sends a raw message to the sender, parsing inline commands embedded within square brackets.
The method supports embedding clickable and hoverable actions into the message text using inline commands. Recognized commands are:
[run_command: <command>]
- Runs the specified command when the message is clicked.[suggest_command: <command>]
- Suggests the specified command in the chat input.[copy_to_clipboard: <text>]
- Copies the specified text to the player's clipboard.[open_url: <url>]
- Opens the specified URL when the message is clicked.[hover: <text>]
- Shows the specified text when the message is hovered over.The commands can be placed anywhere in the message and will apply to the entire message component. If multiple commands of the same type are provided, only the first one encountered will be applied. Unrecognized or invalid commands enclosed in square brackets will be preserved in the output text.
Example usage:
The above message will display:
/help
command when clicked.