mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Add setters to ChatPublic
This commit is contained in:
parent
ad6e19201a
commit
6c920ed00b
1 changed files with 35 additions and 0 deletions
|
@ -90,6 +90,41 @@ pub struct ChatPublic {
|
||||||
pub pinned_message: Option<Box<Message>>,
|
pub pinned_message: Option<Box<Message>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ChatPublic {
|
||||||
|
pub fn new(kind: PublicChatKind) -> Self {
|
||||||
|
Self { title: None, kind, description: None, invite_link: None, pinned_message: None }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn title<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
self.title = Some(val.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn description<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
self.description = Some(val.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn invite_link<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
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]
|
#[serde_with_macros::skip_serializing_none]
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
|
Loading…
Reference in a new issue