Added method \TgBotLib\Bot > addStickerToSet() to add a new sticker to a set created by the bot. See [addStickerToSet](https://core.telegram.org/bots/api#addstickertoset) for more information.

https://git.n64.cc/nosial/libs/tgbot/-/issues/2
This commit is contained in:
Netkas 2023-04-10 16:10:19 -04:00
parent 65564ecb2a
commit 37a136adce
2 changed files with 27 additions and 0 deletions

View file

@ -22,6 +22,8 @@ This update accompanies the release of the [Telegram Bot API 6.6](https://core.t
* Added method `\TgBotLib\Bot > createNewStickerSet()` to create a new sticker set owned by a user. See [createNewStickerSet](https://core.telegram.org/bots/api#createnewstickerset) for more information.
* Added the field _needs_repainting_ to the [Sticker](https://core.telegram.org/bots/api#sticker) class
which can be obtained via `TgBotLib\Objects\Telegram > Sticker > needsRepainting()`
* Added method `\TgBotLib\Bot > addStickerToSet()` to add a new sticker to a set created by the bot.
See [addStickerToSet](https://core.telegram.org/bots/api#addstickertoset) for more information.
### Changed
* Removed unused `__destruct()` method from `\TgBotLib\Bot`

View file

@ -2501,4 +2501,29 @@
return true;
}
/**
* Use this method to add a new sticker to a set created by the bot. The format of the added sticker must match
* the format of the other stickers in the set. Emoji sticker sets can have up to 200 stickers. Animated and
* video sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers.
* Returns True on success.
*
* @param int $user_id User identifier of sticker set owner
* @param string $name Sticker set name
* @param array $sticker An InputSticker 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.
* @return bool
* @throws TelegramException
* @link https://core.telegram.org/bots/api#addstickertoset
* @noinspection PhpUnused
*/
public function addStickerToSet(int $user_id, string $name, array $sticker): bool
{
$this->sendRequest('addStickerToSet', [
'user_id' => $user_id,
'name' => $name,
'sticker' => $sticker
]);
return true;
}
}