use crate::model::prelude::*;
#[derive(Clone, Default, Debug)]
pub struct CustomMessage {
msg: Message,
}
impl CustomMessage {
#[inline]
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[inline]
#[must_use]
pub fn id(&mut self, id: MessageId) -> &mut Self {
self.msg.id = id;
self
}
#[inline]
pub fn attachments(&mut self, attachments: impl IntoIterator<Item = Attachment>) -> &mut Self {
self.msg.attachments = attachments.into_iter().collect();
self
}
#[inline]
pub fn author(&mut self, user: User) -> &mut Self {
self.msg.author = user;
self
}
#[inline]
pub fn channel_id(&mut self, channel_id: ChannelId) -> &mut Self {
self.msg.channel_id = channel_id;
self
}
#[inline]
pub fn content(&mut self, s: impl Into<String>) -> &mut Self {
self.msg.content = s.into();
self
}
#[inline]
pub fn edited_timestamp<T: Into<Timestamp>>(&mut self, timestamp: T) -> &mut Self {
self.msg.edited_timestamp = Some(timestamp.into());
self
}
#[inline]
pub fn embeds(&mut self, embeds: impl IntoIterator<Item = Embed>) -> &mut Self {
self.msg.embeds = embeds.into_iter().collect();
self
}
#[inline]
pub fn guild_id(&mut self, guild_id: GuildId) -> &mut Self {
self.msg.guild_id = Some(guild_id);
self
}
#[inline]
pub fn kind(&mut self, kind: MessageType) -> &mut Self {
self.msg.kind = kind;
self
}
#[inline]
pub fn member(&mut self, member: PartialMember) -> &mut Self {
self.msg.member = Some(Box::new(member));
self
}
#[inline]
pub fn mention_everyone(&mut self, mentions: bool) -> &mut Self {
self.msg.mention_everyone = mentions;
self
}
#[inline]
pub fn mention_roles(&mut self, roles: impl IntoIterator<Item = RoleId>) -> &mut Self {
self.msg.mention_roles = roles.into_iter().collect();
self
}
#[inline]
pub fn mentions(&mut self, mentions: impl IntoIterator<Item = User>) -> &mut Self {
self.msg.mentions = mentions.into_iter().collect();
self
}
#[inline]
pub fn pinned(&mut self, pinned: bool) -> &mut Self {
self.msg.pinned = pinned;
self
}
#[inline]
pub fn reactions(&mut self, reactions: impl IntoIterator<Item = MessageReaction>) -> &mut Self {
self.msg.reactions = reactions.into_iter().collect();
self
}
#[inline]
pub fn timestamp<T: Into<Timestamp>>(&mut self, timestamp: T) -> &mut Self {
self.msg.timestamp = timestamp.into();
self
}
#[inline]
pub fn tts(&mut self, tts: bool) -> &mut Self {
self.msg.tts = tts;
self
}
#[inline]
pub fn webhook_id(&mut self, id: WebhookId) -> &mut Self {
self.msg.webhook_id = Some(id);
self
}
#[inline]
#[must_use]
pub fn build(self) -> Message {
self.msg
}
}