-
Notifications
You must be signed in to change notification settings - Fork 4
Sticker Manager
Abdi Urgessa edited this page Apr 21, 2024
·
7 revisions
telesun.sticker((ctx) => {
ctx.sendSticker({
chat_id: ctx.chat.id,
sticker: 'FILE_ID_OR_URL'
// You can also specify other optional parameters here
});
});
// 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}`);
});
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!');
});
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!');
});
bot.command('delete_sticker', (ctx) => {
ctx.deleteStickerFromSet({
sticker: 'sticker_to_delete_file_id'
});
ctx.reply('Sticker deleted from the set.');
});
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.
- Telesun
- Getting Started - Apps script
- Getting Started with the Telesun Ready Template
- Import Telesun
- Telesun-Handlers
- Context Object
- Next Middleware
- Stages
- Manager Classes:
- Mail:
- Google Spreadsheet:
- Best Practice:
- Getting Updates:
- Example Types:
- Example Bots: