twilight_embed_builder/
lib.rs

1//! # twilight-embed-builder
2//!
3//! [![codecov badge][]][codecov link] [![discord badge][]][discord link] [![github badge][]][github link] [![license badge][]][license link] ![rust badge]
4//!
5//! `twilight-embed-builder` is a set of builder for the [`twilight-rs`]
6//! ecosystem to create a message embed, useful when creating or updating
7//! messages.
8//!
9//! ## Examples
10//!
11//! Build a simple embed:
12//!
13//! ```rust,no_run
14//! use twilight_embed_builder::{EmbedBuilder, EmbedFieldBuilder};
15//!
16//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
17//! let embed = EmbedBuilder::new()
18//!     .description("Here's a list of reasons why Twilight is the best pony:")
19//!     .field(EmbedFieldBuilder::new("Wings", "She has wings.").inline())
20//!     .field(EmbedFieldBuilder::new("Horn", "She can do magic, and she's really good at it.").inline())
21//!     .build()?;
22//! # Ok(()) }
23//! ```
24//!
25//! Build an embed with an image:
26//!
27//! ```rust,no_run
28//! use twilight_embed_builder::{EmbedBuilder, ImageSource};
29//!
30//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
31//! let embed = EmbedBuilder::new()
32//!     .description("Here's a cool image of Twilight Sparkle")
33//!     .image(ImageSource::attachment("bestpony.png")?)
34//!     .build()?;
35//!
36//! # Ok(()) }
37//! ```
38//!
39//! [`twilight-rs`]: https://github.com/twilight-rs/twilight
40//! [codecov badge]: https://img.shields.io/codecov/c/gh/twilight-rs/twilight?logo=codecov&style=for-the-badge&token=E9ERLJL0L2
41//! [codecov link]: https://app.codecov.io/gh/twilight-rs/twilight/
42//! [discord badge]: https://img.shields.io/discord/745809834183753828?color=%237289DA&label=discord%20server&logo=discord&style=for-the-badge
43//! [discord link]: https://discord.gg/7jj8n7D
44//! [github badge]: https://img.shields.io/badge/github-twilight-6f42c1.svg?style=for-the-badge&logo=github
45//! [github link]: https://github.com/twilight-rs/twilight
46//! [license badge]: https://img.shields.io/badge/license-ISC-blue.svg?style=for-the-badge&logo=pastebin
47//! [license link]: https://github.com/twilight-rs/twilight/blob/main/LICENSE.md
48//! [rust badge]: https://img.shields.io/badge/rust-1.60+-93450a.svg?style=for-the-badge&logo=rust
49//! [the discord docs]: https://discord.com/developers/docs/resources/channel#create-message-using-attachments-within-embeds
50
51#![deprecated(since = "0.10.1", note = "use twilight_util::builder::embed")]
52#![deny(
53    clippy::all,
54    clippy::missing_const_for_fn,
55    clippy::pedantic,
56    future_incompatible,
57    missing_docs,
58    nonstandard_style,
59    rust_2018_idioms,
60    rustdoc::broken_intra_doc_links,
61    unsafe_code,
62    unused
63)]
64pub mod image_source;
65
66mod author;
67mod builder;
68mod field;
69mod footer;
70
71pub use self::{
72    author::EmbedAuthorBuilder,
73    builder::{EmbedBuilder, EmbedError, EmbedErrorType},
74    field::EmbedFieldBuilder,
75    footer::EmbedFooterBuilder,
76    image_source::ImageSource,
77};