Skip to content

Sticker Manager

Abdi Urgessa edited this page Apr 21, 2024 · 7 revisions

Usage Examples

Sending a Sticker
telesun.sticker((ctx) => {
  ctx.sendSticker({
    chat_id: ctx.chat.id,
    sticker: 'FILE_ID_OR_URL'
    // You can also specify other optional parameters here
  });
});
Getting a Sticker Set
// Assuming getStickerSet is an async function
telesun.command('get_stickers',(ctx) => {
  const stickerSetName = 'yourStickerSetName';
  const response = ctx.getStickerSet({ name: stickerSetName });
  // Process the response, for example, list stickers
  ctx.reply(`Sticker Set: ${response.title}`);
});
Creating a New Sticker Set
bot.command('create_sticker_set', (ctx) => {
  ctx.createNewStickerSet({
    user_id: ctx.from.id,
    name: 'unique_name_for_stickerset',
    title: 'Sticker Set Title',
    stickers: [{sticker:"<file_id>", emoji_list:"🍓🚗"}],
    sticker_format: "static"
    // You can also include other optional fields
  });
  ctx.reply('Sticker set created successfully!');
});
Adding a Sticker to an Existing Set
bot.command('add_sticker', (ctx) => {
  ctx.addStickerToSet({
    user_id: ctx.from.id,
    name: 'existing_stickerset_name',
    sticker: [{sticker:"<file_id>", emoji_list:"🍓🚗"}],
    // Optional parameters can be included as needed
  });
  ctx.reply('Sticker added to the set!');
});
Deleting a Sticker from a Set
bot.command('delete_sticker', (ctx) => {
  ctx.deleteStickerFromSet({
    sticker: 'sticker_to_delete_file_id'
  });
  ctx.reply('Sticker deleted from the set.');
});

Methods Overview

The StickerManager class encapsulates various methods to interact with stickers on Telegram, including:

  • sendSticker: Sends a sticker to a chat.
  • getStickerSet: Retrieves a sticker set.
  • getCustomEmojiStickers: Gets stickers by custom emoji identifiers.
  • uploadStickerFile: Uploads a .png file to be used as a sticker.
  • createNewStickerSet: Creates a new sticker set.
  • addStickerToSet: Adds a sticker to an existing sticker set.
  • setStickerPositionInSet: Changes the position of a sticker in the set.
  • deleteStickerFromSet: Removes a sticker from a set.
  • setStickerEmojiList, setStickerKeywords, setStickerMaskPosition, setStickerSetTitle, setStickerSetThumbnail, setCustomEmojiStickerSetThumbnail: Various methods for managing the properties of stickers and sticker sets.
  • deleteStickerSet: Deletes a sticker set.
Clone this wiki locally