Sticker Sets
Clients can create, retrieve, and manage sticker sets.
Suggesting a SlugUSER-ONLY
User clients can use suggestStickerSetSlug to generate a slug from a title.
const slug = await client.suggestStickerSetSlug("Cat Stickers");
Creating a Sticker Set
Use checkStickerSetSlug to check whether a slug is available, then pass it to createStickerSet with at least one sticker.
if (!await client.checkStickerSetSlug(slug)) {
throw new Error("The sticker set slug is unavailable.");
}
const stickerSet = await client.createStickerSet(
"Cat Stickers",
slug,
[{ sticker: "./cat.webp", emoji: "🐈" }],
);
Bot clients must pass { userId } as the final argument to identify the owner. User clients omit it.
Getting a Sticker Set
Use getStickerSet with a slug or sticker set link. Use getDiceStickerSet to get the set used by a dice emoji.
const stickerSet = await client.getStickerSet(slug);
const diceStickerSet = await client.getDiceStickerSet("🎲");
Managing Stickers
Use addStickerToStickerSet to add an InputSticker or replaceStickerInStickerSet to replace an existing sticker.
await client.addStickerToStickerSet(
slug,
{ sticker: "./sleeping-cat.webp", emoji: "😴" },
);
await client.replaceStickerInStickerSet(
fileId,
{ sticker: "./new-cat.webp", emoji: "😺" },
);
Bot clients must pass { userId } as the final argument to both methods.
Use replaceStickerEmoji to change a sticker’s emoji, changeStickerPositionInStickerSet to move it, and removeStickerFromStickerSet to remove it.
await client.replaceStickerEmoji(fileId, "😺");
await client.changeStickerPositionInStickerSet(fileId, 0);
await client.removeStickerFromStickerSet(fileId);
Changing Set Details
Use setStickerSetTitle to change the title. Set the thumbnail with setStickerSetThumbnail or setCustomEmojiAsStickerSetThumbnail.
await client.setStickerSetTitle(slug, "Cat Reactions");
await client.setStickerSetThumbnail(slug, "./thumbnail.webp");
await client.setCustomEmojiAsStickerSetThumbnail(slug, customEmojiId);
Bot clients must pass { userId } to setStickerSetThumbnail.
Managing Added Sticker SetsUSER-ONLY
User clients can add an existing set with addStickerSet and list added sets with getAddedStickerSets.
await client.addStickerSet(slug);
const stickerSets = await client.getAddedStickerSets();
Use archiveStickerSet and unarchiveStickerSet to change whether an added set is archived. Use removeStickerSet to remove it from the account.
await client.archiveStickerSet(slug);
await client.unarchiveStickerSet(slug);
await client.removeStickerSet(slug);
Deleting a Sticker Set
Use deleteStickerSet to permanently delete a sticker set.
await client.deleteStickerSet(slug);