diff --git a/kordophoned/src/daemon/models/message.rs b/kordophoned/src/daemon/models/message.rs index da40f80..297dcc7 100644 --- a/kordophoned/src/daemon/models/message.rs +++ b/kordophoned/src/daemon/models/message.rs @@ -64,12 +64,6 @@ pub struct Message { pub attachments: Vec, } -impl Message { - pub fn builder() -> MessageBuilder { - MessageBuilder::new() - } -} - fn attachments_from(file_transfer_guids: &Vec, attachment_metadata: &Option>) -> Vec { file_transfer_guids .iter() @@ -159,59 +153,3 @@ impl From<&OutgoingMessage> for Message { } } } - -pub struct MessageBuilder { - id: Option, - sender: Option, - text: Option, - date: Option, - attachments: Vec, -} - -impl Default for MessageBuilder { - fn default() -> Self { - Self::new() - } -} - -impl MessageBuilder { - pub fn new() -> Self { - Self { - id: None, - sender: None, - text: None, - date: None, - attachments: Vec::new(), - } - } - - pub fn sender(mut self, sender: Participant) -> Self { - self.sender = Some(sender); - self - } - - pub fn text(mut self, text: String) -> Self { - self.text = Some(text); - self - } - - pub fn date(mut self, date: NaiveDateTime) -> Self { - self.date = Some(date); - self - } - - pub fn attachments(mut self, attachments: Vec) -> Self { - self.attachments = attachments; - self - } - - pub fn build(self) -> Message { - Message { - id: self.id.unwrap_or_else(|| Uuid::new_v4().to_string()), - sender: self.sender.unwrap_or(Participant::Me), - text: self.text.unwrap_or_default(), - date: self.date.unwrap_or_else(|| chrono::Utc::now().naive_utc()), - attachments: self.attachments, - } - } -} \ No newline at end of file