[][src]Trait serenity::utils::EmbedMessageBuilding

pub trait EmbedMessageBuilding {
    fn push_named_link<T: I, U: I>(&mut self, name: T, url: U) -> &mut Self;
fn push_named_link_safe<T: I, U: I>(&mut self, name: T, url: U) -> &mut Self; }

A trait with additional functionality over the MessageBuilder for creating content with additional functionality available only in embeds.

Namely, this allows you to create named links via the non-escaping push_named_link method and the escaping push_named_link_safe method.

Examples

Make a named link to Rust's GitHub organization:

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)");

Required methods

Pushes a named link to a message, intended for use in embeds.

Examples

Make a simple link to Rust's homepage for use in an embed:

use serenity::utils::{EmbedMessageBuilding, MessageBuilder};

let mut msg = MessageBuilder::new();
msg.push("Rust's website: ");
msg.push_named_link("Homepage", "https://rust-lang.org");
let content = msg.build();

assert_eq!(content, "Rust's website: [Homepage](https://rust-lang.org)");

Pushes a named link intended for use in an embed, but with a normalized name to avoid escaping issues.

Refer to push_named_link for more information.

Examples

use serenity::utils::{EmbedMessageBuilding, MessageBuilder};

let mut msg = MessageBuilder::new();
msg.push("A weird website name: ");
msg.push_named_link_safe("Try to ] break links (](", "https://rust-lang.org");
let content = msg.build();

assert_eq!(content, "A weird website name: [Try to   break links ( (](https://rust-lang.org)");
Loading content...

Implementors

impl EmbedMessageBuilding for MessageBuilder[src]

Loading content...