Stickers

replaceStickerInSet()

Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success.

parameters

parametertyperequireddescription
user_idnumberrequiredUser identifier of the sticker set owner
namestringrequiredSticker set name
old_stickerstringrequiredFile identifier of the replaced sticker
stickerInputStickerrequiredA JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.

returns

boolean

usage in yaebal

replaceStickerInSet is directly typed on Api — call it straight off bot.api.

bot.ts
import type { ReplaceStickerInSetParams } from "@yaebal/types";

await bot.api.replaceStickerInSet({
  user_id: 123456789,
  name: "...",
  old_sticker: "...",
  sticker: {} /* InputSticker */,
} satisfies ReplaceStickerInSetParams);

context shortcut

also available as ctx.replaceStickerInSet() on 16 context types — see @yaebal/contexts.

context shortcut
/** Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling [deleteStickerFromSet](https://core.telegram.org/bots/api/#deletestickerfromset), then [addStickerToSet](https://core.telegram.org/bots/api/#addstickertoset), then [setStickerPositionInSet](https://core.telegram.org/bots/api/#setstickerpositioninset). Returns *True* on success. */
ctx.replaceStickerInSet(params: Omit<ReplaceStickerInSetParams, "user_id"> & { user_id?: number })