Crates.io | discord-webhook-rs |
lib.rs | discord-webhook-rs |
version | |
source | src |
created_at | 2025-04-13 22:01:10.926431+00 |
updated_at | 2025-04-21 15:33:43.007076+00 |
description | Rust library to send Discord webhooks. |
homepage | |
repository | |
max_upload_size | |
id | 1632187 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A Rust library for sending Discord webhooks easily.
Add this to your Cargo.toml
:
[dependencies]
discord-webhook-rs = "1.0.5"
use discord_webhook_rs::{Webhook, Error, Embed, Author, Field, Footer};
const WEBHOOK_URL: &str = "https://discord.com/api/webhooks/...";
fn main() -> Result<(), Error> {
Webhook::new(WEBHOOK_URL)
.content("Hello from Rust!")
.username("Étienne")
.avatar_url("https://avatars.githubusercontent.com/u/145381924")
.add_embed(
Embed::new()
.title("Thanks")
.description("Thanks for using **discord-webhook-rs**!")
.author(Author::new().name("Crab"))
.add_field(Field::new().name("Field 1").value("Value 1").inline(true))
.add_field(Field::new().name("Field 2").value("Value 2").inline(false))
.footer(Footer::new().text("footer"))
)
.add_file("my_file.txt")
.send()?;
Ok(())
}
This project is licensed under the MIT License, see the LICENSE file for details.