From b08ec342e5545e66d061aa83126cdb142464658a Mon Sep 17 00:00:00 2001 From: teidesu <86301490+teidesu@users.noreply.github.com> Date: Thu, 18 Aug 2022 21:34:35 +0300 Subject: [PATCH] feat(client): export customEmojiId in Sticker --- packages/client/src/types/media/sticker.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/client/src/types/media/sticker.ts b/packages/client/src/types/media/sticker.ts index d008d260..e59957c9 100644 --- a/packages/client/src/types/media/sticker.ts +++ b/packages/client/src/types/media/sticker.ts @@ -5,6 +5,7 @@ import { TelegramClient } from '../../client' import { RawDocument } from './document' import { makeInspectable } from '../utils' import { StickerSet } from '../misc' +import { MtArgumentError } from '../errors' export namespace Sticker { export interface MaskPosition { @@ -141,6 +142,18 @@ export class Sticker extends RawDocument { : false } + /** + * If this is a custom emoji, its unique ID + * that can be used in {@link TelegramClient#getCustomEmojis} + */ + get customEmojiId(): tl.Long { + if (this.attr._ !== 'documentAttributeCustomEmoji') { + throw new MtArgumentError('This is not a custom emoji') + } + + return this.raw.id + } + /** * Type of the sticker */