feat(client): isValidSticker field

This commit is contained in:
teidesu 2021-07-22 01:47:06 +03:00
parent 4c717ffc63
commit 4b417afd81

View file

@ -74,6 +74,19 @@ export class Sticker extends RawDocument {
return this.attrSize?.h ?? 512 return this.attrSize?.h ?? 512
} }
/**
* Whether this sticker is a valid sticker.
*
* If it is not, then this is probably a WEBP photo
* that Telegram treats as a sticker.
*/
get isValidSticker(): boolean {
return (
this.attrSize !== undefined &&
(this.attrSize.w === 512 || this.attrSize.h === 512)
)
}
/** /**
* Primary emoji associated with this sticker, * Primary emoji associated with this sticker,
* that is displayed in dialogs list. * that is displayed in dialogs list.
@ -118,7 +131,9 @@ export class Sticker extends RawDocument {
* Input sticker set that it associated with this sticker, if available. * Input sticker set that it associated with this sticker, if available.
*/ */
get inputStickerSet(): tl.TypeInputStickerSet | null { get inputStickerSet(): tl.TypeInputStickerSet | null {
return this.attr.stickerset._ === 'inputStickerSetEmpty' ? null : this.attr.stickerset return this.attr.stickerset._ === 'inputStickerSetEmpty'
? null
: this.attr.stickerset
} }
private _maskPosition?: Sticker.MaskPosition private _maskPosition?: Sticker.MaskPosition