#discord #data-structures #webhook #containing #utilities #messages #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

#47 in #containing

Download history 14/week @ 2023-12-17 2/week @ 2023-12-31 9/week @ 2024-01-14 3/week @ 2024-01-21 16/week @ 2024-01-28 4/week @ 2024-02-11 30/week @ 2024-02-18 127/week @ 2024-02-25 26/week @ 2024-03-03 29/week @ 2024-03-10 22/week @ 2024-03-17 56/week @ 2024-03-24 57/week @ 2024-03-31

167 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

~2–3MB
~92K SLoC