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

pub struct CreateMessage(pub BTreeMap<String, Value>);

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

There are two situations where different field requirements are present:

  1. When sending an embed, no other field is required;
  2. Otherwise, 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 Context::say may be a more preferable option.

Examples

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

// assuming you are in a context
context.send_message(message.channel_id, |m|
    .content("test")
    .tts(true));

Methods

impl CreateMessage
[src]

Set the content of the message.

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

Set an embed for the message.

Set the nonce. This is used for validation of a sent message. You most likely don't need to worry about this.

Defaults to empty.

Set whether the message is text-to-speech.

Think carefully before setting this to true.

Defaults to false.

Trait Implementations

impl Default for CreateMessage
[src]

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