-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add `EmbedMessageBuilding` trait as extension to `MessageBuilder` (#599) Add a trait to the `utils` module, `EmbedMessageBuilding`, which adds additional functionality for embed-only content. The trait is implemented on the `MessageBuilder`. This is a separate trait so that users knowingly opt-in to embed-only functionality when they import it to avoid confusion when calls to embed-only methods don't work outside of embeds. This currently contains two methods, the non-escaping `push_named_link` and its escaping version `push_named_link_safe`. These are both for making a named link with standard Markdown, like `[Rust](https://rust-lang.org)`. An example of using this is: ```rust use serenity::utils::{EmbedMessageBuilding, MessageBuilder}; let msg = MessageBuilder::new() .push_named_link("Rust's GitHub", "https://github.com/rust-lang") .build(); assert_eq!(msg, "[Rust's GitHub](https://github.com/rust-lang)"); ``` (cherry picked from commit 3db66ab)
- Loading branch information
1 parent
4541935
commit 7c61f95
Showing
2 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters