2021-04-25 15:39:42 +03:00
|
|
|
import { TelegramClient } from '../../client'
|
|
|
|
import { tl } from '@mtcute/tl'
|
|
|
|
import { StickerSet } from '../../types'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a sticker pack and stickers inside of it.
|
|
|
|
*
|
|
|
|
* @param id Sticker pack short name, dice emoji, `"emoji"` for animated emojis or input ID
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
export async function getStickerSet(
|
|
|
|
this: TelegramClient,
|
|
|
|
id: string | { dice: string } | tl.TypeInputStickerSet
|
|
|
|
): Promise<StickerSet> {
|
|
|
|
let input: tl.TypeInputStickerSet
|
|
|
|
if (typeof id === 'string') {
|
2021-06-06 15:20:41 +03:00
|
|
|
input =
|
|
|
|
id === 'emoji'
|
|
|
|
? {
|
|
|
|
_: 'inputStickerSetAnimatedEmoji',
|
|
|
|
}
|
|
|
|
: {
|
|
|
|
_: 'inputStickerSetShortName',
|
|
|
|
shortName: id,
|
|
|
|
}
|
2021-04-25 15:39:42 +03:00
|
|
|
} else if ('dice' in id) {
|
|
|
|
input = {
|
|
|
|
_: 'inputStickerSetDice',
|
2021-06-06 15:20:41 +03:00
|
|
|
emoticon: id.dice,
|
2021-04-25 15:39:42 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
input = id
|
|
|
|
}
|
|
|
|
|
|
|
|
const res = await this.call({
|
|
|
|
_: 'messages.getStickerSet',
|
2021-06-06 15:20:41 +03:00
|
|
|
stickerset: input,
|
2021-04-25 15:39:42 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
return new StickerSet(this, res)
|
|
|
|
}
|