Crate discord_message

Source
Expand description

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();
}

Structs§

DiscordMessage
The main message type
Embed
Describes an embed
EmbedAuthor
Describes an embed author
EmbedField
Describes a field that can be used inside a message embed
EmbedFooter
Describes an embed footer
EmbedImage
Describes an embed image
EmbedThumbnail
Describes an embed thumbnail
Error
This type represents all possible errors that can occur when serializing or deserializing JSON data.