[−][src]Struct serenity::builder::CreateMessage
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:
- 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 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 });
Implementations
impl<'a> CreateMessage<'a>
[src]
pub fn content<D: ToString>(&mut self, content: D) -> &mut Self
[src]
Set the content of the message.
Note: Message contents must be under 2000 unicode code points.
pub fn embed<F>(&mut self, f: F) -> &mut Self where
F: FnOnce(&mut CreateEmbed) -> &mut CreateEmbed,
[src]
F: FnOnce(&mut CreateEmbed) -> &mut CreateEmbed,
Set an embed for the message.
pub fn tts(&mut self, tts: bool) -> &mut Self
[src]
Set whether the message is text-to-speech.
Think carefully before setting this to true
.
Defaults to false
.
pub fn reactions<R: Into<ReactionType>, It: IntoIterator<Item = R>>(
&mut self,
reactions: It
) -> &mut Self
[src]
&mut self,
reactions: It
) -> &mut Self
Adds a list of reactions to create after the message's sent.
pub fn add_file<T: Into<AttachmentType<'a>>>(&mut self, file: T) -> &mut Self
[src]
Appends a file to the message.
pub fn add_files<T: Into<AttachmentType<'a>>, It: IntoIterator<Item = T>>(
&mut self,
files: It
) -> &mut Self
[src]
&mut self,
files: It
) -> &mut Self
Appends a list of files to the message.
pub fn files<T: Into<AttachmentType<'a>>, It: IntoIterator<Item = T>>(
&mut self,
files: It
) -> &mut Self
[src]
&mut self,
files: It
) -> &mut Self
Sets a list of files to include in the message.
Calling this multiple times will overwrite the file list.
To append files, call add_file
or add_files
instead.
Trait Implementations
impl<'a> Clone for CreateMessage<'a>
[src]
pub fn clone(&self) -> CreateMessage<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Debug for CreateMessage<'a>
[src]
impl<'a> Default for CreateMessage<'a>
[src]
pub fn default() -> CreateMessage<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for CreateMessage<'a>
impl<'a> Send for CreateMessage<'a>
impl<'a> Sync for CreateMessage<'a>
impl<'a> Unpin for CreateMessage<'a>
impl<'a> UnwindSafe for CreateMessage<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
[src]
T: Clone + Any,
pub fn clone_any(&self) -> Box<dyn CloneAny + 'static, Global>
[src]
pub fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send, Global> where
T: Send,
[src]
T: Send,
pub fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync, Global> where
T: Sync,
[src]
T: Sync,
pub fn clone_any_send_sync(
&self
) -> Box<dyn CloneAny + 'static + Send + Sync, Global> where
T: Send + Sync,
[src]
&self
) -> Box<dyn CloneAny + 'static + Send + Sync, Global> where
T: Send + Sync,
impl<T> DebugAny for T where
T: Any + Debug,
[src]
T: Any + Debug,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,