pub struct Sticker {
pub file: FileMeta,
pub width: u16,
pub height: u16,
pub kind: StickerKind,
pub flags: StickerFormatFlags,
pub thumbnail: Option<PhotoSize>,
pub emoji: Option<String>,
pub set_name: Option<String>,
pub needs_repainting: bool,
}Expand description
This object represents a sticker.
Fields§
§file: FileMetaMetadata of the sticker file.
width: u16Sticker 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: u16Sticker 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: StickerKindKind 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.
flags: StickerFormatFlagsFormat flags of this sticker:
(is_animated, is_video) == (false, false) - raster/.webp or
is_animated == true - animated/.tgs or
is_video == true - video/.webm.
In other words this represents how the sticker is encoded.
thumbnail: 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.
needs_repainting: boolTrue, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places
Implementations§
Source§impl Sticker
impl Sticker
Sourcepub fn format(&self) -> StickerFormat
pub fn format(&self) -> StickerFormat
Returns the format of the Sticker based on the self.flags values
Sourcepub fn is_static(&self) -> bool
pub fn is_static(&self) -> bool
Returns true is this is a “normal” raster sticker.
Alias to self.format().is_static().
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<&CustomEmojiId>
pub fn custom_emoji_id(&self) -> Option<&CustomEmojiId>
Getter for StickerKind::CustomEmoji::custom_emoji_id.
Trait Implementations§
Source§impl Deref for Sticker
This allows calling StickerKind’s methods directly on Sticker.
impl Deref for Sticker
This allows calling StickerKind’s methods directly on Sticker.
use teloxide_core_ng::types::Sticker;
let sticker: Sticker = todo!();
let _ = sticker.is_regular();
let _ = sticker.kind.is_regular();
let _ = sticker.mask_position();
let _ = sticker.kind.mask_position();Source§impl<'de> Deserialize<'de> for Sticker
impl<'de> Deserialize<'de> for Sticker
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Sticker, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Sticker, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Sticker
impl Serialize for Sticker
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for Sticker
impl StructuralPartialEq for Sticker
Auto Trait Implementations§
impl Freeze for Sticker
impl RefUnwindSafe for Sticker
impl Send for Sticker
impl Sync for Sticker
impl Unpin for Sticker
impl UnwindSafe for Sticker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Erasable for T
impl<T> Erasable for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more