Crates.io | ferrishook |
lib.rs | ferrishook |
version | 2.0.1 |
source | src |
created_at | 2021-09-21 05:38:34.543366 |
updated_at | 2021-11-15 08:20:50.525589 |
description | Discord WebHook API |
homepage | |
repository | https://github.com/Fn79/ferrishook-rs |
max_upload_size | |
id | 454254 |
size | 75,773 |
Discord Webhook API
cargo run --example webhook
use ferrishook::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let secret = "webhook_key";
webhook::new(secret, |x| {
x.content("Hello, World!")
.username("Rusty WebHook")
.avatar_url("https://avatars.githubusercontent.com/u/74909209")
.embed(|e| {
e.title("Embed Title")
.description("Embed Description")
.thumbnail("https://avatars.githubusercontent.com/u/5430905")
.author(|a| {
a.name("Author Name")
.icon_url("https://avatars.githubusercontent.com/u/9919")
})
.color(15258703)
.image("https://i.imgur.com/nBeX2Y3.jpg")
.footer(|f| f.text("Footer").icon_url("https://i.imgur.com/vk1RYK4.png"))
.add_field("Field 1", "Value 1", false)
.add_field("Field 2", "Value 2", false)
})
})
.send()
.await?;
Ok(())
}
License - GPL-2.0