pub struct Sticker {
pub file: FileMeta,
pub width: u16,
pub height: u16,
pub kind: StickerKind,
pub format: StickerFormat,
pub thumb: Option<PhotoSize>,
pub emoji: Option<String>,
pub set_name: Option<String>,
}
Expand description
This object represents a sticker.
Fields§
§file: FileMeta
Metadata of the sticker file.
width: u16
Sticker width, in pixels.
You can assume that max(width, height) = 512
, min(width, height) <= 512
. In other words one dimension is exactly 512 pixels and the other
is at most 512 pixels.
height: u16
Sticker height, in pixels.
You can assume that max(width, height) = 512
, min(width, height) <= 512
. In other words one dimension is exactly 512 pixels and the other
is at most 512 pixels.
kind: StickerKind
Kind of this sticker - regular, mask or custom emoji.
In other words this represent how the sticker is presented, as a big picture/video, as a mask while editing pictures or as a custom emoji in messages.
format: StickerFormat
Format of this sticker - raster/.webp
, animated/.tgs
or
video/.webm
.
In other words this represents how the sticker is encoded.
thumb: Option<PhotoSize>
Sticker thumbnail in the .webp
or .jpg
format.
emoji: Option<String>
Emoji associated with the sticker.
set_name: Option<String>
Name of the sticker set to which the sticker belongs.
Implementations§
source§impl Sticker
impl Sticker
sourcepub fn is_raster(&self) -> bool
pub fn is_raster(&self) -> bool
Returns true
is this is a “normal” raster sticker.
Alias to self.format.is_raster()
.
sourcepub fn is_animated(&self) -> bool
pub fn is_animated(&self) -> bool
Returns true
is this is an animated sticker.
Alias to self.format.is_animated()
.
sourcepub fn is_video(&self) -> bool
pub fn is_video(&self) -> bool
Returns true
is this is a video sticker.
Alias to self.format.is_video()
.
Methods from Deref<Target = StickerKind>§
sourcepub fn type_(&self) -> StickerType
pub fn type_(&self) -> StickerType
Converts StickerKind
to StickerType
sourcepub fn is_regular(&self) -> bool
pub fn is_regular(&self) -> bool
Returns true
if the sticker kind is Regular
.
sourcepub fn is_custom_emoji(&self) -> bool
pub fn is_custom_emoji(&self) -> bool
Returns true
if the sticker kind is CustomEmoji
.
Getter for StickerKind::Regular::premium_animation
.
sourcepub fn mask_position(&self) -> Option<MaskPosition>
pub fn mask_position(&self) -> Option<MaskPosition>
Getter for StickerKind::Mask::mask_position
.
sourcepub fn custom_emoji_id(&self) -> Option<&str>
pub fn custom_emoji_id(&self) -> Option<&str>
Getter for StickerKind::CustomEmoji::custom_emoji_id
.
Trait Implementations§
source§impl Deref for Sticker
impl Deref for Sticker
This allows calling StickerKind
’s methods directly on Sticker
.
use teloxide_core::types::Sticker;
let sticker: Sticker = todo!();
let _ = sticker.is_regular();
let _ = sticker.kind.is_regular();
let _ = sticker.mask_position();
let _ = sticker.kind.mask_position();