[][src]Struct twilight_http::request::channel::message::create_message::CreateMessage

pub struct CreateMessage<'a> { /* fields omitted */ }

Send a message to a channel.

Example

use twilight_http::Client;
use twilight_model::id::ChannelId;

let client = Client::new("my token");

let channel_id = ChannelId(123);
let message = client
    .create_message(channel_id)
    .content("Twilight is best pony")?
    .tts(true)
    .await?;

Implementations

impl<'a> CreateMessage<'a>[src]

pub fn allowed_mentions(
    self
) -> AllowedMentionsBuilder<'a, Unspecified, Unspecified, Unspecified>
[src]

Return a new AllowedMentionsBuilder.

pub fn attachment(
    self,
    name: impl Into<String>,
    file: impl Into<Vec<u8>>
) -> Self
[src]

Attach a new file to the message.

The file is raw binary data. It can be an image, or any other kind of file.

pub fn attachments<N: Into<String>, F: Into<Vec<u8>>>(
    self,
    attachments: impl IntoIterator<Item = (N, F)>
) -> Self
[src]

Insert multiple attachments into the message.

pub fn content(
    self,
    content: impl Into<String>
) -> Result<Self, CreateMessageError>
[src]

Set the content of the message.

The maximum length is 2000 UTF-16 characters.

Errors

Returns CreateMessageError::ContentInvalid if the content length is too long.

pub fn embed(self, embed: Embed) -> Result<Self, CreateMessageError>[src]

Set the embed of the message.

Embed total character length must not exceed 6000 characters. Additionally, the internal fields also have character limits. Refer to the discord docs for more information.

Examples

See EmbedBuilder for an example.

Errors

Returns CreateMessageError::EmbedTooLarge if the embed is too large.

pub fn nonce(self, nonce: u64) -> Self[src]

Attach a nonce to the message, for optimistic message sending.

pub fn payload_json(self, payload_json: impl Into<Vec<u8>>) -> Self[src]

JSON encoded body of any additional request fields. See Discord Docs/Create Message

pub fn reply(self, other: MessageId) -> Self[src]

Specify the ID of another message to create a reply to.

pub fn tts(self, tts: bool) -> Self[src]

Specify true if the message is TTS.

Trait Implementations

impl Future for CreateMessage<'_>[src]

type Output = Result<Message>

The type of value produced on completion.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for CreateMessage<'a>[src]

impl<'a> Send for CreateMessage<'a>[src]

impl<'a> !Sync for CreateMessage<'a>[src]

impl<'a> Unpin for CreateMessage<'a>[src]

impl<'a> !UnwindSafe for CreateMessage<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

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

The output that the future will produce on completion.

type Future = F

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

Which kind of future are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,