2022-06-30 16:32:56 +03:00
|
|
|
import { fileIdToInputDocument, tdFileId } from '@mtcute/file-id'
|
2023-06-05 03:30:48 +03:00
|
|
|
import { tl } from '@mtcute/tl'
|
2022-06-30 16:32:56 +03:00
|
|
|
|
|
|
|
import { TelegramClient } from '../../client'
|
2021-05-05 23:26:28 +03:00
|
|
|
import { StickerSet } from '../../types'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Move a sticker in a sticker set
|
|
|
|
* to another position
|
|
|
|
*
|
|
|
|
* Only for bots, and the sticker set must
|
|
|
|
* have been created by this bot.
|
|
|
|
*
|
|
|
|
* @param sticker
|
|
|
|
* TDLib and Bot API compatible File ID, or a
|
|
|
|
* TL object representing a sticker to be removed
|
|
|
|
* @param position New sticker position (starting from 0)
|
|
|
|
* @returns Modfiied sticker set
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
|
|
|
|
export async function moveStickerInSet(
|
|
|
|
this: TelegramClient,
|
|
|
|
sticker: string | tdFileId.RawFullRemoteFileLocation | tl.TypeInputDocument,
|
2023-06-05 03:30:48 +03:00
|
|
|
position: number,
|
2021-05-05 23:26:28 +03:00
|
|
|
): Promise<StickerSet> {
|
|
|
|
if (tdFileId.isFileIdLike(sticker)) {
|
|
|
|
sticker = fileIdToInputDocument(sticker)
|
|
|
|
}
|
|
|
|
|
|
|
|
const res = await this.call({
|
|
|
|
_: 'stickers.changeStickerPosition',
|
|
|
|
sticker,
|
2021-06-06 15:20:41 +03:00
|
|
|
position,
|
2021-05-05 23:26:28 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
return new StickerSet(this, res)
|
|
|
|
}
|