Crates.io | twilight-embed-builder |
lib.rs | twilight-embed-builder |
version | 0.11.1 |
source | src |
created_at | 2020-08-30 02:57:02.562452 |
updated_at | 2022-07-07 01:38:10.892273 |
description | Create validated message embeds for the Twilight ecosystem. |
homepage | https://twilight.rs/chapter_1_crates/section_8_first_party/section_1_embed_builder.html |
repository | https://github.com/twilight-rs/twilight.git |
max_upload_size | |
id | 282544 |
size | 55,678 |
twilight-embed-builder
is a set of builder for the twilight-rs
ecosystem to create a message embed, useful when creating or updating
messages.
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()?;