6 stable releases

2.1.2 Dec 13, 2022
2.1.1 Sep 12, 2022
2.0.0 Dec 15, 2021
1.0.1 Jul 18, 2020

#1746 in Web programming

Download history 140/week @ 2024-06-18 161/week @ 2024-06-25 101/week @ 2024-07-02 190/week @ 2024-07-09 211/week @ 2024-07-16 275/week @ 2024-07-23 233/week @ 2024-07-30 167/week @ 2024-08-06 227/week @ 2024-08-13 286/week @ 2024-08-20 268/week @ 2024-08-27 277/week @ 2024-09-03 354/week @ 2024-09-10 263/week @ 2024-09-17 249/week @ 2024-09-24 188/week @ 2024-10-01

1,087 downloads per month
Used in 3 crates

MIT license

32KB
831 lines

webhook-rs

Discord Webhook API Wrapper

Crate Crate Docs

Example usage

Using an application webhook, you may also create message components (so far only buttons). For a full example, take a look at examples/example.rs.

let url: &str = "Webhook URL";
let client: WebhookClient = WebhookClient::new(url);
client.send(|message| message
    .username("Thoo")
    .avatar_url(IMAGE_URL)
    .embed(|embed| embed
        .title("Webhook")
        .description("Hello, World!")
        .footer("Footer", Some(String::from(IMAGE_URL)))
        .image(IMAGE_URL)
        .thumbnail(IMAGE_URL)
        .author("Lmao#0001", Some(String::from(IMAGE_URL)), Some(String::from(IMAGE_URL)))
        .field("name", "value", false))).await?;

Get started

To get started, simply add the crate to your Cargo.toml.

[dependencies]
webhook = "2.1.1"

If you only want the types, you can get rid of the networking-related dependencies by using the feature models.

[dependencies]
webhook = { version = "2.1.1", features = ["models"] }

To do

  • Attachments
  • Components

Contribute

Any type of contribution is greatly appreciated.

Dependencies

~0.7–12MB
~167K SLoC