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:
- When sending an
embed
, no other field is required; - 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]
fn content(self, content: &str) -> Self
Set the content of the message.
Note: Message contents must be under 2000 unicode code points.
fn embed<F>(self, f: F) -> Self where F: FnOnce(CreateEmbed) -> CreateEmbed
Set an embed for the message.
fn nonce(self, nonce: &str) -> Self
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.
fn tts(self, tts: bool) -> Self
Set whether the message is text-to-speech.
Think carefully before setting this to true
.
Defaults to false
.