twilight-embed-builder

Crates.iotwilight-embed-builder
lib.rstwilight-embed-builder
version0.11.1
sourcesrc
created_at2020-08-30 02:57:02.562452
updated_at2022-07-07 01:38:10.892273
descriptionCreate validated message embeds for the Twilight ecosystem.
homepagehttps://twilight.rs/chapter_1_crates/section_8_first_party/section_1_embed_builder.html
repositoryhttps://github.com/twilight-rs/twilight.git
max_upload_size
id282544
size55,678
Erk (Erk-)

documentation

https://docs.rs/twilight-embed-builder

README

twilight-embed-builder

codecov badge discord badge github badge license badge rust badge

twilight-embed-builder is a set of builder for the twilight-rs ecosystem to create a message embed, useful when creating or updating messages.

Examples

Build a simple embed:

use twilight_embed_builder::{EmbedBuilder, EmbedFieldBuilder};

let embed = EmbedBuilder::new()
    .description("Here's a list of reasons why Twilight is the best pony:")
    .field(EmbedFieldBuilder::new("Wings", "She has wings.").inline())
    .field(EmbedFieldBuilder::new("Horn", "She can do magic, and she's really good at it.").inline())
    .build()?;

Build an embed with an image:

use twilight_embed_builder::{EmbedBuilder, ImageSource};

let embed = EmbedBuilder::new()
    .description("Here's a cool image of Twilight Sparkle")
    .image(ImageSource::attachment("bestpony.png")?)
    .build()?;

Commit count: 2436

cargo fmt