Add GetStickerSet method

This commit is contained in:
netkas 2024-11-14 22:36:02 -05:00
parent ea6fe91d9d
commit a5b472794d
2 changed files with 41 additions and 0 deletions

View file

@ -104,6 +104,7 @@
use TgBotLib\Methods\UnpinAllForumTopicMessages; use TgBotLib\Methods\UnpinAllForumTopicMessages;
use TgBotLib\Methods\UnpinAllGeneralForumTopicMessages; use TgBotLib\Methods\UnpinAllGeneralForumTopicMessages;
use TgBotLib\Methods\UnpinChatMessage; use TgBotLib\Methods\UnpinChatMessage;
use TgBotLib\Objects\GetStickerSet;
enum Methods : string enum Methods : string
{ {
@ -206,6 +207,7 @@
case DELETE_MESSAGE = 'deleteMessage'; case DELETE_MESSAGE = 'deleteMessage';
case DELETE_MESSAGES = 'deleteMessages'; case DELETE_MESSAGES = 'deleteMessages';
case SEND_STICKER = 'sendSticker'; case SEND_STICKER = 'sendSticker';
case GET_STICKER_SET = 'getStickerSet';
/** /**
* Executes a command on the provided bot with the given parameters. * Executes a command on the provided bot with the given parameters.
@ -318,6 +320,7 @@
self::DELETE_MESSAGE => DeleteMessage::execute($bot, $parameters), self::DELETE_MESSAGE => DeleteMessage::execute($bot, $parameters),
self::DELETE_MESSAGES => DeleteMessages::execute($bot, $parameters), self::DELETE_MESSAGES => DeleteMessages::execute($bot, $parameters),
self::SEND_STICKER => SendSticker::execute($bot, $parameters), self::SEND_STICKER => SendSticker::execute($bot, $parameters),
self::GET_STICKER_SET => GetStickerSet::execute($bot, $parameters),
}; };
} }
} }

View file

@ -0,0 +1,38 @@
<?php
namespace TgBotLib\Objects;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Objects\Stickers\StickerSet;
class GetStickerSet extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): StickerSet
{
return StickerSet::fromArray(self::executeCurl(self::buildPost($bot, Methods::GET_STICKER_SET->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'name'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}