Struct serenity::builder::CreateMessage[][src]

pub struct CreateMessage<'a>(pub HashMap<&'static str, Value>, pub Option<Vec<ReactionType>>, pub Vec<AttachmentType<'a>>);
Expand description

A builder to specify the contents of an Http::send_message request, primarily meant for use through ChannelId::send_message.

There are two situations where different field requirements are present:

  1. When sending an Self::embed, no other field is required;
  2. Otherwise, Self::content is the only required field that is required to be set.

Note that if you only need to send the content of a message, without specifying other fields, then ChannelId::say may be a more preferable option.

Examples

Sending a message with a content of "test" and applying text-to-speech:

use serenity::model::id::ChannelId;

let channel_id = ChannelId(7);

let _ = channel_id.send_message(&http, |m| {
    m.content("test");
    m.tts(true);

    m.embed(|mut e| {
        e.title("This is an embed");
        e.description("With a description");

        e
    });

    m
});

Tuple Fields

0: HashMap<&'static str, Value>1: Option<Vec<ReactionType>>2: Vec<AttachmentType<'a>>

Implementations

Set the content of the message.

Note: Message contents must be under 2000 unicode code points.

Add an embed for the message.

Note: This will keep all existing embeds. Use Self::set_embed() to replace existing embeds.

Add multiple embeds for the message.

Note: This will keep all existing embeds. Use Self::set_embeds() to replace existing embeds.

Set an embed for the message.

Equivalent to Self::set_embed().

Note: This will replace all existing embeds. Use Self::add_embed() to add an additional embed.

Set an embed for the message.

Equivalent to Self::embed().

Note: This will replace all existing embeds. Use Self::add_embed() to add an additional embed.

Set multiple embeds for the message.

Note: This will replace all existing embeds. Use Self::add_embeds() to keep existing embeds.

Set whether the message is text-to-speech.

Think carefully before setting this to true.

Defaults to false.

Adds a list of reactions to create after the message’s sent.

Appends a file to the message.

Appends a list of files to the message.

Sets a list of files to include in the message.

Calling this multiple times will overwrite the file list. To append files, call Self::add_file or Self::add_files instead.

Set the allowed mentions for the message.

Set the reference message this message is a reply to.

Creates components for this message.

Sets the components of this message.

Sets the flags for the message.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Creates a map for sending a Message, setting Self::tts to false by default.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more