3 stable releases

2.0.1 Nov 15, 2021
1.0.0 Sep 21, 2021

#47 in #author

GPL-2.0 license

18KB
249 lines

Ferris Hook

Discord Webhook API

Usage

Example

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

Dependencies

~8–20MB
~280K SLoC