diff --git a/src/types/chat.rs b/src/types/chat.rs index 66e39785..0bf9b844 100644 --- a/src/types/chat.rs +++ b/src/types/chat.rs @@ -90,6 +90,41 @@ pub struct ChatPublic { pub pinned_message: Option>, } +impl ChatPublic { + pub fn new(kind: PublicChatKind) -> Self { + Self { title: None, kind, description: None, invite_link: None, pinned_message: None } + } + + pub fn title(mut self, val: S) -> Self + where + S: Into, + { + self.title = Some(val.into()); + self + } + + pub fn description(mut self, val: S) -> Self + where + S: Into, + { + self.description = Some(val.into()); + self + } + + pub fn invite_link(mut self, val: S) -> Self + where + S: Into, + { + self.invite_link = Some(val.into()); + self + } + + pub fn pinned_message(mut self, val: Message) -> Self { + self.pinned_message = Some(Box::new(val)); + self + } +} + #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive]