ferrishook

Crates.ioferrishook
lib.rsferrishook
version2.0.1
sourcesrc
created_at2021-09-21 05:38:34.543366
updated_at2021-11-15 08:20:50.525589
descriptionDiscord WebHook API
homepage
repositoryhttps://github.com/Fn79/ferrishook-rs
max_upload_size
id454254
size75,773
(Fn79)

documentation

README

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

Commit count: 0

cargo fmt