pub struct WebHookEmbed {
pub title: Option<String>,
pub description: Option<String>,
pub color: Option<u32>,
pub author: Option<WebHookEmbedAuthor>,
pub fields: Option<Vec<WebHookEmbedField>>,
pub footer: Option<WebHookEmbedFooter>,
pub image: Option<WebHookEmbedImage>,
pub thumbnail: Option<WebHookEmbedThumbnail>,
}
Fields§
§title: Option<String>
§description: Option<String>
§color: Option<u32>
§fields: Option<Vec<WebHookEmbedField>>
§image: Option<WebHookEmbedImage>
§thumbnail: Option<WebHookEmbedThumbnail>
Implementations§
Source§impl WebHookEmbed
impl WebHookEmbed
pub fn new() -> WebHookEmbed
Sourcepub fn title<T: AsRef<str>>(self, title: T) -> WebHookEmbed
pub fn title<T: AsRef<str>>(self, title: T) -> WebHookEmbed
Examples found in repository?
examples/webhook.rs (line 11)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let secret = "webhook_key";
6 webhook::new(secret, |x| {
7 x.content("Hello, World!")
8 .username("Rusty WebHook")
9 .avatar_url("https://avatars.githubusercontent.com/u/74909209")
10 .embed(|e| {
11 e.title("Embed Title")
12 .description("Embed Description")
13 .thumbnail("https://avatars.githubusercontent.com/u/5430905")
14 .author(|a| {
15 a.name("Author Name")
16 .icon_url("https://avatars.githubusercontent.com/u/9919")
17 })
18 .color(15258703)
19 .image("https://i.imgur.com/nBeX2Y3.jpg")
20 .footer(|f| f.text("Footer").icon_url("https://i.imgur.com/vk1RYK4.png"))
21 .add_field("Field 1", "Value 1", false)
22 .add_field("Field 2", "Value 2", false)
23 })
24 })
25 .send()
26 .await?;
27
28 Ok(())
29}
Sourcepub fn description<T: AsRef<str>>(self, description: T) -> WebHookEmbed
pub fn description<T: AsRef<str>>(self, description: T) -> WebHookEmbed
Examples found in repository?
examples/webhook.rs (line 12)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let secret = "webhook_key";
6 webhook::new(secret, |x| {
7 x.content("Hello, World!")
8 .username("Rusty WebHook")
9 .avatar_url("https://avatars.githubusercontent.com/u/74909209")
10 .embed(|e| {
11 e.title("Embed Title")
12 .description("Embed Description")
13 .thumbnail("https://avatars.githubusercontent.com/u/5430905")
14 .author(|a| {
15 a.name("Author Name")
16 .icon_url("https://avatars.githubusercontent.com/u/9919")
17 })
18 .color(15258703)
19 .image("https://i.imgur.com/nBeX2Y3.jpg")
20 .footer(|f| f.text("Footer").icon_url("https://i.imgur.com/vk1RYK4.png"))
21 .add_field("Field 1", "Value 1", false)
22 .add_field("Field 2", "Value 2", false)
23 })
24 })
25 .send()
26 .await?;
27
28 Ok(())
29}
Sourcepub fn color(self, color: u32) -> WebHookEmbed
pub fn color(self, color: u32) -> WebHookEmbed
Examples found in repository?
examples/webhook.rs (line 18)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let secret = "webhook_key";
6 webhook::new(secret, |x| {
7 x.content("Hello, World!")
8 .username("Rusty WebHook")
9 .avatar_url("https://avatars.githubusercontent.com/u/74909209")
10 .embed(|e| {
11 e.title("Embed Title")
12 .description("Embed Description")
13 .thumbnail("https://avatars.githubusercontent.com/u/5430905")
14 .author(|a| {
15 a.name("Author Name")
16 .icon_url("https://avatars.githubusercontent.com/u/9919")
17 })
18 .color(15258703)
19 .image("https://i.imgur.com/nBeX2Y3.jpg")
20 .footer(|f| f.text("Footer").icon_url("https://i.imgur.com/vk1RYK4.png"))
21 .add_field("Field 1", "Value 1", false)
22 .add_field("Field 2", "Value 2", false)
23 })
24 })
25 .send()
26 .await?;
27
28 Ok(())
29}
Sourcepub fn image<T: AsRef<str>>(self, url: T) -> WebHookEmbed
pub fn image<T: AsRef<str>>(self, url: T) -> WebHookEmbed
Examples found in repository?
examples/webhook.rs (line 19)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let secret = "webhook_key";
6 webhook::new(secret, |x| {
7 x.content("Hello, World!")
8 .username("Rusty WebHook")
9 .avatar_url("https://avatars.githubusercontent.com/u/74909209")
10 .embed(|e| {
11 e.title("Embed Title")
12 .description("Embed Description")
13 .thumbnail("https://avatars.githubusercontent.com/u/5430905")
14 .author(|a| {
15 a.name("Author Name")
16 .icon_url("https://avatars.githubusercontent.com/u/9919")
17 })
18 .color(15258703)
19 .image("https://i.imgur.com/nBeX2Y3.jpg")
20 .footer(|f| f.text("Footer").icon_url("https://i.imgur.com/vk1RYK4.png"))
21 .add_field("Field 1", "Value 1", false)
22 .add_field("Field 2", "Value 2", false)
23 })
24 })
25 .send()
26 .await?;
27
28 Ok(())
29}
Sourcepub fn thumbnail<T: AsRef<str>>(self, url: T) -> WebHookEmbed
pub fn thumbnail<T: AsRef<str>>(self, url: T) -> WebHookEmbed
Examples found in repository?
examples/webhook.rs (line 13)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let secret = "webhook_key";
6 webhook::new(secret, |x| {
7 x.content("Hello, World!")
8 .username("Rusty WebHook")
9 .avatar_url("https://avatars.githubusercontent.com/u/74909209")
10 .embed(|e| {
11 e.title("Embed Title")
12 .description("Embed Description")
13 .thumbnail("https://avatars.githubusercontent.com/u/5430905")
14 .author(|a| {
15 a.name("Author Name")
16 .icon_url("https://avatars.githubusercontent.com/u/9919")
17 })
18 .color(15258703)
19 .image("https://i.imgur.com/nBeX2Y3.jpg")
20 .footer(|f| f.text("Footer").icon_url("https://i.imgur.com/vk1RYK4.png"))
21 .add_field("Field 1", "Value 1", false)
22 .add_field("Field 2", "Value 2", false)
23 })
24 })
25 .send()
26 .await?;
27
28 Ok(())
29}
Examples found in repository?
examples/webhook.rs (lines 14-17)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let secret = "webhook_key";
6 webhook::new(secret, |x| {
7 x.content("Hello, World!")
8 .username("Rusty WebHook")
9 .avatar_url("https://avatars.githubusercontent.com/u/74909209")
10 .embed(|e| {
11 e.title("Embed Title")
12 .description("Embed Description")
13 .thumbnail("https://avatars.githubusercontent.com/u/5430905")
14 .author(|a| {
15 a.name("Author Name")
16 .icon_url("https://avatars.githubusercontent.com/u/9919")
17 })
18 .color(15258703)
19 .image("https://i.imgur.com/nBeX2Y3.jpg")
20 .footer(|f| f.text("Footer").icon_url("https://i.imgur.com/vk1RYK4.png"))
21 .add_field("Field 1", "Value 1", false)
22 .add_field("Field 2", "Value 2", false)
23 })
24 })
25 .send()
26 .await?;
27
28 Ok(())
29}
Examples found in repository?
examples/webhook.rs (line 20)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let secret = "webhook_key";
6 webhook::new(secret, |x| {
7 x.content("Hello, World!")
8 .username("Rusty WebHook")
9 .avatar_url("https://avatars.githubusercontent.com/u/74909209")
10 .embed(|e| {
11 e.title("Embed Title")
12 .description("Embed Description")
13 .thumbnail("https://avatars.githubusercontent.com/u/5430905")
14 .author(|a| {
15 a.name("Author Name")
16 .icon_url("https://avatars.githubusercontent.com/u/9919")
17 })
18 .color(15258703)
19 .image("https://i.imgur.com/nBeX2Y3.jpg")
20 .footer(|f| f.text("Footer").icon_url("https://i.imgur.com/vk1RYK4.png"))
21 .add_field("Field 1", "Value 1", false)
22 .add_field("Field 2", "Value 2", false)
23 })
24 })
25 .send()
26 .await?;
27
28 Ok(())
29}
Sourcepub fn add_field<T: AsRef<str>>(
self,
name: T,
value: T,
inline: bool,
) -> WebHookEmbed
pub fn add_field<T: AsRef<str>>( self, name: T, value: T, inline: bool, ) -> WebHookEmbed
Examples found in repository?
examples/webhook.rs (line 21)
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let secret = "webhook_key";
6 webhook::new(secret, |x| {
7 x.content("Hello, World!")
8 .username("Rusty WebHook")
9 .avatar_url("https://avatars.githubusercontent.com/u/74909209")
10 .embed(|e| {
11 e.title("Embed Title")
12 .description("Embed Description")
13 .thumbnail("https://avatars.githubusercontent.com/u/5430905")
14 .author(|a| {
15 a.name("Author Name")
16 .icon_url("https://avatars.githubusercontent.com/u/9919")
17 })
18 .color(15258703)
19 .image("https://i.imgur.com/nBeX2Y3.jpg")
20 .footer(|f| f.text("Footer").icon_url("https://i.imgur.com/vk1RYK4.png"))
21 .add_field("Field 1", "Value 1", false)
22 .add_field("Field 2", "Value 2", false)
23 })
24 })
25 .send()
26 .await?;
27
28 Ok(())
29}
Trait Implementations§
Source§impl Debug for WebHookEmbed
impl Debug for WebHookEmbed
Source§impl Deserialize for WebHookEmbed
impl Deserialize for WebHookEmbed
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for WebHookEmbed
impl RefUnwindSafe for WebHookEmbed
impl Send for WebHookEmbed
impl Sync for WebHookEmbed
impl Unpin for WebHookEmbed
impl UnwindSafe for WebHookEmbed
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more