Added method \TgBotLib\Bot > setStickerSetThumbnail()
to set the thumbnail of a sticker set. See [setStickerSetThumbnail](https://core.telegram.org/bots/api#setstickersetthumbnail) for more information.
https://git.n64.cc/nosial/libs/tgbot/-/issues/2
This commit is contained in:
parent
b4e0f62e99
commit
917077c19a
2 changed files with 35 additions and 0 deletions
|
@ -30,6 +30,8 @@ This update accompanies the release of the [Telegram Bot API 6.6](https://core.t
|
|||
* Added method `\TgBotLib\Bot > setCustomEmojiStickerSetThumbnail()` to set the thumbnail of a sticker set.
|
||||
See [setCustomEmojiStickerSetThumbnail](https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail) for more information.
|
||||
* Added object `\TgBotLib\Objects\Telegram > StickerSet` to represent a sticker set.
|
||||
* Added method `\TgBotLib\Bot > setStickerSetThumbnail()` to set the thumbnail of a sticker set.
|
||||
See [setStickerSetThumbnail](https://core.telegram.org/bots/api#setstickersetthumbnail) for more information.
|
||||
|
||||
### Changed
|
||||
* Removed unused `__destruct()` method from `\TgBotLib\Bot`
|
||||
|
|
|
@ -2593,4 +2593,37 @@
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param string $name Sticker set name
|
||||
* @param int $user_id User identifier of the sticker set owner
|
||||
* @param string $thumb 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#animated-sticker-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-sticker-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 ». 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.
|
||||
* @param array $options Optional parameters
|
||||
* @return bool
|
||||
* @throws TelegramException
|
||||
*/
|
||||
public function setStickerSetThumbnail(string $name, int $user_id, string $thumb, array $options=[]): bool
|
||||
{
|
||||
if(file_exists($thumb))
|
||||
{
|
||||
$thumb = new CURLFile($thumb);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp_file = new TempFile();
|
||||
file_put_contents($tmp_file, $thumb);
|
||||
$thumb = new CURLFile($tmp_file);
|
||||
}
|
||||
|
||||
$this->sendRequest('setStickerSetThumbnail', array_merge([
|
||||
'name' => $name,
|
||||
'user_id' => $user_id,
|
||||
'thumb' => $thumb
|
||||
], $options));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue