mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Add setters to Sticker
This commit is contained in:
parent
fd89c138f0
commit
f4a87b0d70
1 changed files with 90 additions and 0 deletions
|
@ -43,3 +43,93 @@ pub struct Sticker {
|
|||
/// File size.
|
||||
pub file_size: Option<u32>,
|
||||
}
|
||||
|
||||
impl Sticker {
|
||||
pub fn new<S1, S2>(
|
||||
file_id: S1,
|
||||
file_unique_id: S2,
|
||||
width: u16,
|
||||
height: u16,
|
||||
is_animated: bool,
|
||||
) -> Self
|
||||
where
|
||||
S1: Into<String>,
|
||||
S2: Into<String>,
|
||||
{
|
||||
Self {
|
||||
file_id: file_id.into(),
|
||||
file_unique_id: file_unique_id.into(),
|
||||
width,
|
||||
height,
|
||||
is_animated,
|
||||
thumb: None,
|
||||
emoji: None,
|
||||
set_name: None,
|
||||
mask_position: None,
|
||||
file_size: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn file_id<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.file_id = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn file_unique_id<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.file_unique_id = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn height(mut self, val: u16) -> Self {
|
||||
self.height = val;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn width(mut self, val: u16) -> Self {
|
||||
self.width = val;
|
||||
self
|
||||
}
|
||||
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_animated(mut self, val: bool) -> Self {
|
||||
self.is_animated = val;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn thumb(mut self, val: PhotoSize) -> Self {
|
||||
self.thumb = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn emoji<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.emoji = Some(val.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_name<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.set_name = Some(val.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn mask_position(mut self, val: MaskPosition) -> Self {
|
||||
self.mask_position = Some(val);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn file_size(mut self, val: u32) -> Self {
|
||||
self.file_size = Some(val);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue