diff --git a/packages/client/src/types/media/document-utils.ts b/packages/client/src/types/media/document-utils.ts index 47a630b9..6c7eb791 100644 --- a/packages/client/src/types/media/document-utils.ts +++ b/packages/client/src/types/media/document-utils.ts @@ -21,8 +21,12 @@ export function parseDocument( } case 'documentAttributeSticker': { const sz = doc.attributes.find( - (it) => it._ === 'documentAttributeImageSize' - )! as tl.RawDocumentAttributeImageSize + (it) => + it._ === 'documentAttributeImageSize' || + it._ === 'documentAttributeVideo' + )! as + | tl.RawDocumentAttributeImageSize + | tl.RawDocumentAttributeVideo return new Sticker(client, doc, attr, sz) } case 'documentAttributeVideo': diff --git a/packages/client/src/types/media/sticker.ts b/packages/client/src/types/media/sticker.ts index 56d8dd38..3170272d 100644 --- a/packages/client/src/types/media/sticker.ts +++ b/packages/client/src/types/media/sticker.ts @@ -50,7 +50,7 @@ export class Sticker extends RawDocument { client: TelegramClient, doc: tl.RawDocument, readonly attr: tl.RawDocumentAttributeSticker, - readonly attrSize?: tl.RawDocumentAttributeImageSize + readonly attr2?: tl.RawDocumentAttributeImageSize | tl.RawDocumentAttributeVideo ) { super(client, doc) } @@ -59,14 +59,21 @@ export class Sticker extends RawDocument { * Sticker width in pixels */ get width(): number { - return this.attrSize?.w ?? 512 + return this.attr2?.w ?? 512 } /** * Sticker height in pixels */ get height(): number { - return this.attrSize?.h ?? 512 + return this.attr2?.h ?? 512 + } + + /** + * Whether this sticker is a video (WEBM) sticker + */ + get isVideoSticker(): boolean { + return this.attr2?._ === 'documentAttributeVideo' } /** @@ -77,8 +84,8 @@ export class Sticker extends RawDocument { */ get isValidSticker(): boolean { return ( - this.attrSize !== undefined && - (this.attrSize.w === 512 || this.attrSize.h === 512) + this.attr2 !== undefined && + (this.attr2.w === 512 || this.attr2.h === 512) ) } diff --git a/packages/client/src/types/misc/sticker-set.ts b/packages/client/src/types/misc/sticker-set.ts index 3fe1fb34..71466a12 100644 --- a/packages/client/src/types/misc/sticker-set.ts +++ b/packages/client/src/types/misc/sticker-set.ts @@ -88,6 +88,13 @@ export class StickerSet { return this.brief.animated! } + /** + * Whether this stickerset is video (WEBM) + */ + get isVideo(): boolean { + return this.brief.videos! + } + /** * Date when this stickerset was installed */