Add GetCustomEmojiStickers method

This commit is contained in:
netkas 2024-11-14 22:37:56 -05:00
parent a5b472794d
commit 36e2305ce7
2 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,45 @@
<?php
namespace TgBotLib\Objects;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Objects\Stickers\Sticker;
class GetCustomEmojiStickers extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): array
{
if(isset($parameters['custom_emoji_ids']) && is_array($parameters['custom_emoji_ids']))
{
$parameters['custom_emoji_ids'] = json_encode($parameters['custom_emoji_ids']);
}
return array_map(function($emoji) {
return Sticker::fromArray($emoji);
}, self::executeCurl(self::buildPost($bot, Methods::GET_CUSTOM_EMOJI_STICKERS->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'custom_emoji_ids'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}