mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-21 14:29:01 +01:00
Add setters to StickerSet
This commit is contained in:
parent
f4a87b0d70
commit
9b3ce4b0bb
1 changed files with 58 additions and 0 deletions
|
@ -25,3 +25,61 @@ pub struct StickerSet {
|
||||||
/// List of all set stickers.
|
/// List of all set stickers.
|
||||||
pub stickers: Vec<Sticker>,
|
pub stickers: Vec<Sticker>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl StickerSet {
|
||||||
|
pub fn new<S1, S2, St>(
|
||||||
|
name: S1,
|
||||||
|
title: S2,
|
||||||
|
is_animated: bool,
|
||||||
|
contains_masks: bool,
|
||||||
|
stickers: St,
|
||||||
|
) -> Self
|
||||||
|
where
|
||||||
|
S1: Into<String>,
|
||||||
|
S2: Into<String>,
|
||||||
|
St: Into<Vec<Sticker>>,
|
||||||
|
{
|
||||||
|
Self {
|
||||||
|
name: name.into(),
|
||||||
|
title: title.into(),
|
||||||
|
is_animated,
|
||||||
|
contains_masks,
|
||||||
|
stickers: stickers.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn name<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
self.name = val.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn title<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
self.title = val.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::wrong_self_convention)]
|
||||||
|
pub fn is_animated(mut self, val: bool) -> Self {
|
||||||
|
self.is_animated = val;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn contains_masks(mut self, val: bool) -> Self {
|
||||||
|
self.contains_masks = val;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn stickers<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<Vec<Sticker>>,
|
||||||
|
{
|
||||||
|
self.stickers = val.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue