pub struct CustomMessage { /* private fields */ }
Expand description
Implementations§
Source§impl CustomMessage
impl CustomMessage
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new instance of this builder, alongside a message with dummy data. Use the methods to replace the individual bits of this message with valid data.
Sourcepub fn id(&mut self, id: MessageId) -> &mut Self
pub fn id(&mut self, id: MessageId) -> &mut Self
Assign the dummy message a proper ID for identification.
If not used, the default value is MessageId::new(1)
.
Sourcepub fn attachments(
&mut self,
attachments: impl IntoIterator<Item = Attachment>,
) -> &mut Self
pub fn attachments( &mut self, attachments: impl IntoIterator<Item = Attachment>, ) -> &mut Self
Assign the dummy message files attached to it.
If not used, the default value is an empty vector (Vec::default()
).
Assign the dummy message its author.
If not used, the default value is a dummy User
.
Sourcepub fn channel_id(&mut self, channel_id: ChannelId) -> &mut Self
pub fn channel_id(&mut self, channel_id: ChannelId) -> &mut Self
Assign the dummy message its origin channel’s ID.
If not used, the default value is ChannelId::new(1)
.
Sourcepub fn content(&mut self, s: impl Into<String>) -> &mut Self
pub fn content(&mut self, s: impl Into<String>) -> &mut Self
Assign the dummy message its contents.
If not used, the default value is an empty string (String::default()
).
Sourcepub fn edited_timestamp<T: Into<Timestamp>>(
&mut self,
timestamp: T,
) -> &mut Self
pub fn edited_timestamp<T: Into<Timestamp>>( &mut self, timestamp: T, ) -> &mut Self
Assign the dummy message the timestamp it was edited.
If not used, the default value is None
(not all messages are edited).
Sourcepub fn embeds(&mut self, embeds: impl IntoIterator<Item = Embed>) -> &mut Self
pub fn embeds(&mut self, embeds: impl IntoIterator<Item = Embed>) -> &mut Self
Assign the dummy message embeds.
If not used, the default value is an empty vector (Vec::default()
).
Sourcepub fn guild_id(&mut self, guild_id: GuildId) -> &mut Self
pub fn guild_id(&mut self, guild_id: GuildId) -> &mut Self
Assign the dummy message its origin guild’s ID.
If not used, the default value is None
(not all messages are sent in guilds).
Sourcepub fn kind(&mut self, kind: MessageType) -> &mut Self
pub fn kind(&mut self, kind: MessageType) -> &mut Self
Assign the dummy message its type.
If not used, the default value is MessageType::Regular
.
Sourcepub fn member(&mut self, member: PartialMember) -> &mut Self
pub fn member(&mut self, member: PartialMember) -> &mut Self
Sourcepub fn mention_everyone(&mut self, mentions: bool) -> &mut Self
pub fn mention_everyone(&mut self, mentions: bool) -> &mut Self
Assign the dummy message a flag whether it mentions everyone (@everyone
).
If not used, the default value is false
.
Sourcepub fn mention_roles(
&mut self,
roles: impl IntoIterator<Item = RoleId>,
) -> &mut Self
pub fn mention_roles( &mut self, roles: impl IntoIterator<Item = RoleId>, ) -> &mut Self
Assign the dummy message a list of roles it mentions.
If not used, the default value is an empty vector (Vec::default()
).
Sourcepub fn mentions(
&mut self,
mentions: impl IntoIterator<Item = User>,
) -> &mut Self
pub fn mentions( &mut self, mentions: impl IntoIterator<Item = User>, ) -> &mut Self
Assign the dummy message a list of mentions.
If not used, the default value is an empty vector (Vec::default()
).
Sourcepub fn pinned(&mut self, pinned: bool) -> &mut Self
pub fn pinned(&mut self, pinned: bool) -> &mut Self
Assign the dummy message a flag whether it’s been pinned.
If not used, the default value is false
.
Sourcepub fn reactions(
&mut self,
reactions: impl IntoIterator<Item = MessageReaction>,
) -> &mut Self
pub fn reactions( &mut self, reactions: impl IntoIterator<Item = MessageReaction>, ) -> &mut Self
Assign the dummy message a list of emojis it was reacted with.
If not used, the default value is an empty vector (Vec::default()
).
Sourcepub fn timestamp<T: Into<Timestamp>>(&mut self, timestamp: T) -> &mut Self
pub fn timestamp<T: Into<Timestamp>>(&mut self, timestamp: T) -> &mut Self
Assign the dummy message the timestamp it was created at.
If not used, the default value is the current local time.
Sourcepub fn tts(&mut self, tts: bool) -> &mut Self
pub fn tts(&mut self, tts: bool) -> &mut Self
Assign the dummy message a flag whether it’ll be read by a Text-To-Speech program.
If not used, the default value is false
.
Sourcepub fn webhook_id(&mut self, id: WebhookId) -> &mut Self
pub fn webhook_id(&mut self, id: WebhookId) -> &mut Self
Assign the dummy message the webhook author’s ID.
If not used, the default value is None
(not all messages are sent by webhooks).
Trait Implementations§
Source§impl Clone for CustomMessage
impl Clone for CustomMessage
Source§fn clone(&self) -> CustomMessage
fn clone(&self) -> CustomMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more