#discord #data-structures #webhook #messages #containing #utilities #build

discord-message

A crate containing the utilities needed to build Discord webhook messages from Rust

1 unstable release

0.1.0 Jul 22, 2021

#41 in #containing

Download history 24/week @ 2024-04-27 13/week @ 2024-05-04 35/week @ 2024-05-11 34/week @ 2024-05-18 30/week @ 2024-05-25 24/week @ 2024-06-01 14/week @ 2024-06-08 9/week @ 2024-06-15 29/week @ 2024-06-22 46/week @ 2024-06-29 39/week @ 2024-07-06 195/week @ 2024-07-13 291/week @ 2024-07-20 386/week @ 2024-07-27 283/week @ 2024-08-03 269/week @ 2024-08-10

1,302 downloads per month
Used in 3 crates

GPL-3.0 license

6KB
52 lines

discord-message

Crates.io Docs.rs

discord-message is a crate containing the utilities needed to build Discord webhook messages from Rust

Example message creation

fn main() {
    let message = DiscordMessage {
        username: Some("BotMan".to_string()),
        content: "Text message. Up to 2000 characters.".to_string(),
        embeds: vec![
            Embed {
                title: "Title".to_string(),
                description: "Text message. You can use Markdown here.".to_string(),
                ..Default::default()
            }
        ],
        ..Default::default()
    };
    let json = message.to_json().unwrap();
}

lib.rs:

discord-message is a crate containing the utilities needed to build Discord webhook messages from Rust.

Example message creation

fn main() {
    let message = DiscordMessage {
        username: Some("BotMan".to_string()),
        content: "Text message. Up to 2000 characters.".to_string(),
        embeds: vec![
            Embed {
                title: "Title".to_string(),
                description: "Text message. You can use Markdown here.".to_string(),
                ..Default::default()
            }
        ],
        ..Default::default()
    };
    let json = message.to_json().unwrap();
}

Dependencies

~1.7–2.9MB
~82K SLoC