TelegramPHP Documentation

StickerApi

This file is generated from spec/openapi.json (Bot API 10.3) by tools/generate.php.

Do not edit it by hand - run composer spec:build instead.

Sticker sets: creating them, editing their contents, and their thumbnails.

Mixed into Telegram through Methods. Every method is named exactly as the Bot API names it, takes exactly the fields the Bot API documents (use named arguments for the optional ones), and resolves with the hydrated result.

Tags
link
https://core.telegram.org/bots/api
since

v10.3

Table of Contents

Methods

addStickerToSet()  : PromiseInterface<string|int, bool>
Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success.
createNewStickerSet()  : PromiseInterface<string|int, bool>
Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success.
deleteChatStickerSet()  : PromiseInterface<string|int, bool>
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
deleteStickerFromSet()  : PromiseInterface<string|int, bool>
Use this method to delete a sticker from a set created by the bot. Returns True on success.
deleteStickerSet()  : PromiseInterface<string|int, bool>
Use this method to delete a sticker set that was created by the bot. Returns True on success.
getCustomEmojiStickers()  : PromiseInterface<string|int, Collection<string|int, Sticker>>
Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.
getForumTopicIconStickers()  : PromiseInterface<string|int, Collection<string|int, Sticker>>
Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects.
getStickerSet()  : PromiseInterface<string|int, StickerSet>
Use this method to get a sticker set. On success, a StickerSet object is returned.
replaceStickerInSet()  : PromiseInterface<string|int, bool>
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.
sendSticker()  : PromiseInterface<string|int, Message>
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned.
setChatStickerSet()  : PromiseInterface<string|int, bool>
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
setCustomEmojiStickerSetThumbnail()  : PromiseInterface<string|int, bool>
Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.
setStickerEmojiList()  : PromiseInterface<string|int, bool>
Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.
setStickerKeywords()  : PromiseInterface<string|int, bool>
Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.
setStickerMaskPosition()  : PromiseInterface<string|int, bool>
Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success.
setStickerPositionInSet()  : PromiseInterface<string|int, bool>
Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.
setStickerSetThumbnail()  : PromiseInterface<string|int, bool>
Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success.
setStickerSetTitle()  : PromiseInterface<string|int, bool>
Use this method to set the title of a created sticker set. Returns True on success.

Methods

addStickerToSet()

Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success.

public addStickerToSet(int $user_id, string $name, InputSticker|array<string|int, mixed> $sticker) : PromiseInterface<string|int, bool>
Parameters
$user_id : int

User identifier of sticker set owner

$name : string

Sticker set name

$sticker : InputSticker|array<string|int, mixed>

A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.

Tags
link
https://core.telegram.org/bots/api#addstickertoset
Return values
PromiseInterface<string|int, bool>

createNewStickerSet()

Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success.

public createNewStickerSet(int $user_id, string $name, string $title, array<int, InputSticker|array<string|int, mixed>> $stickers[, string|null $sticker_type = null ][, bool|null $needs_repainting = null ]) : PromiseInterface<string|int, bool>
Parameters
$user_id : int

User identifier of created sticker set owner

$name : string

Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "by<bot_username>". <bot_username> is case insensitive. 1-64 characters.

$title : string

Sticker set title, 1-64 characters

$stickers : array<int, InputSticker|array<string|int, mixed>>

A JSON-serialized list of 1-50 initial stickers to be added to the sticker set

$sticker_type : string|null = null

Optional. Type of stickers in the set, pass "regular", "mask", or "custom_emoji". By default, a regular sticker set is created.

$needs_repainting : bool|null = null

Optional. Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only

Tags
link
https://core.telegram.org/bots/api#createnewstickerset
Return values
PromiseInterface<string|int, bool>

deleteChatStickerSet()

Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.

public deleteChatStickerSet(int|string $chat_id) : PromiseInterface<string|int, bool>

Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

Tags
link
https://core.telegram.org/bots/api#deletechatstickerset
Return values
PromiseInterface<string|int, bool>

deleteStickerFromSet()

Use this method to delete a sticker from a set created by the bot. Returns True on success.

public deleteStickerFromSet(string $sticker) : PromiseInterface<string|int, bool>
Parameters
$sticker : string

File identifier of the sticker

Tags
link
https://core.telegram.org/bots/api#deletestickerfromset
Return values
PromiseInterface<string|int, bool>

deleteStickerSet()

Use this method to delete a sticker set that was created by the bot. Returns True on success.

public deleteStickerSet(string $name) : PromiseInterface<string|int, bool>
Parameters
$name : string

Sticker set name

Tags
link
https://core.telegram.org/bots/api#deletestickerset
Return values
PromiseInterface<string|int, bool>

getCustomEmojiStickers()

Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.

public getCustomEmojiStickers(array<int, string> $custom_emoji_ids) : PromiseInterface<string|int, Collection<string|int, Sticker>>
Parameters
$custom_emoji_ids : array<int, string>

A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.

Tags
link
https://core.telegram.org/bots/api#getcustomemojistickers
Return values
PromiseInterface<string|int, Collection<string|int, Sticker>>

getForumTopicIconStickers()

Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects.

public getForumTopicIconStickers() : PromiseInterface<string|int, Collection<string|int, Sticker>>
Tags
link
https://core.telegram.org/bots/api#getforumtopiciconstickers
Return values
PromiseInterface<string|int, Collection<string|int, Sticker>>

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.

public replaceStickerInSet(int $user_id, string $name, string $old_sticker, InputSticker|array<string|int, mixed> $sticker) : PromiseInterface<string|int, bool>

Returns True on success.

Parameters
$user_id : int

User identifier of the sticker set owner

$name : string

Sticker set name

$old_sticker : string

File identifier of the replaced sticker

$sticker : InputSticker|array<string|int, mixed>

A 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.

Tags
link
https://core.telegram.org/bots/api#replacestickerinset
Return values
PromiseInterface<string|int, bool>

sendSticker()

Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned.

public sendSticker(int|string $chat_id, InputFile|string $sticker[, string|null $business_connection_id = null ][, int|null $message_thread_id = null ][, int|null $direct_messages_topic_id = null ][, EphemeralMessageParameters|array<string|int, mixed>|null $ephemeral_message_parameters = null ][, string|null $emoji = null ][, bool|null $disable_notification = null ][, bool|null $protect_content = null ][, bool|null $allow_paid_broadcast = null ][, string|null $message_effect_id = null ][, SuggestedPostParameters|array<string|int, mixed>|null $suggested_post_parameters = null ][, ReplyParameters|array<string|int, mixed>|null $reply_parameters = null ][, InlineKeyboardMarkup|array<string|int, mixed>|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $reply_markup = null ]) : PromiseInterface<string|int, Message>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target bot, supergroup or channel in the format @username

$sticker : InputFile|string

Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Video and animated stickers can't be sent via an HTTP URL.

$business_connection_id : string|null = null

Optional. Unique identifier of the business connection on behalf of which the message will be sent

$message_thread_id : int|null = null

Optional. Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only

$direct_messages_topic_id : int|null = null

Optional. Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat

$ephemeral_message_parameters : EphemeralMessageParameters|array<string|int, mixed>|null = null

Optional. A JSON-serialized object containing the parameters of the ephemeral message to send

$emoji : string|null = null

Optional. Emoji associated with the sticker; only for just uploaded stickers

$disable_notification : bool|null = null

Optional. Sends the message silently. Users will receive a notification with no sound.

$protect_content : bool|null = null

Optional. Protects the contents of the sent message from forwarding and saving

$allow_paid_broadcast : bool|null = null

Optional. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance.

$message_effect_id : string|null = null

Optional. Unique identifier of the message effect to be added to the message; for private chats only

$suggested_post_parameters : SuggestedPostParameters|array<string|int, mixed>|null = null

Optional. A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.

$reply_parameters : ReplyParameters|array<string|int, mixed>|null = null

Optional. Description of the message to reply to

$reply_markup : InlineKeyboardMarkup|array<string|int, mixed>|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null = null

Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.

Tags
link
https://core.telegram.org/bots/api#sendsticker
Return values
PromiseInterface<string|int, Message>

setChatStickerSet()

Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.

public setChatStickerSet(int|string $chat_id, string $sticker_set_name) : PromiseInterface<string|int, bool>

Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$sticker_set_name : string

Name of the sticker set to be set as the group sticker set

Tags
link
https://core.telegram.org/bots/api#setchatstickerset
Return values
PromiseInterface<string|int, bool>

setCustomEmojiStickerSetThumbnail()

Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.

public setCustomEmojiStickerSetThumbnail(string $name[, string|null $custom_emoji_id = null ]) : PromiseInterface<string|int, bool>
Parameters
$name : string

Sticker set name

$custom_emoji_id : string|null = null

Optional. Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail

Tags
link
https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
Return values
PromiseInterface<string|int, bool>

setStickerEmojiList()

Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

public setStickerEmojiList(string $sticker, array<int, string> $emoji_list) : PromiseInterface<string|int, bool>
Parameters
$sticker : string

File identifier of the sticker

$emoji_list : array<int, string>

A JSON-serialized list of 1-20 emoji associated with the sticker

Tags
link
https://core.telegram.org/bots/api#setstickeremojilist
Return values
PromiseInterface<string|int, bool>

setStickerKeywords()

Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

public setStickerKeywords(string $sticker[, array<int, string>|null $keywords = null ]) : PromiseInterface<string|int, bool>
Parameters
$sticker : string

File identifier of the sticker

$keywords : array<int, string>|null = null

Optional. A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters

Tags
link
https://core.telegram.org/bots/api#setstickerkeywords
Return values
PromiseInterface<string|int, bool>

setStickerMaskPosition()

Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success.

public setStickerMaskPosition(string $sticker[, MaskPosition|array<string|int, mixed>|null $mask_position = null ]) : PromiseInterface<string|int, bool>
Parameters
$sticker : string

File identifier of the sticker

$mask_position : MaskPosition|array<string|int, mixed>|null = null

Optional. A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.

Tags
link
https://core.telegram.org/bots/api#setstickermaskposition
Return values
PromiseInterface<string|int, bool>

setStickerPositionInSet()

Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.

public setStickerPositionInSet(string $sticker, int $position) : PromiseInterface<string|int, bool>
Parameters
$sticker : string

File identifier of the sticker

$position : int

New sticker position in the set, zero-based

Tags
link
https://core.telegram.org/bots/api#setstickerpositioninset
Return values
PromiseInterface<string|int, bool>

setStickerSetThumbnail()

Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success.

public setStickerSetThumbnail(string $name, int $user_id, string $format[, InputFile|string|null $thumbnail = null ]) : PromiseInterface<string|int, bool>
Parameters
$name : string

Sticker set name

$user_id : int

User identifier of the sticker set owner

$format : string

Format of the thumbnail, must be one of "static" for a .WEBP or .PNG image, "animated" for a .TGS animation, or "video" for a .WEBM video

$thumbnail : InputFile|string|null = null

Optional. A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.

Tags
link
https://core.telegram.org/bots/api#setstickersetthumbnail
Return values
PromiseInterface<string|int, bool>

setStickerSetTitle()

Use this method to set the title of a created sticker set. Returns True on success.

public setStickerSetTitle(string $name, string $title) : PromiseInterface<string|int, bool>
Parameters
$name : string

Sticker set name

$title : string

Sticker set title, 1-64 characters

Tags
link
https://core.telegram.org/bots/api#setstickersettitle
Return values
PromiseInterface<string|int, bool>
On this page

Search results