Add support for fetching forum topic icon stickers

This commit is contained in:
netkas 2024-11-06 19:24:59 -05:00
parent fedf177803
commit 4accf1713c
2 changed files with 43 additions and 0 deletions

View file

@ -27,6 +27,7 @@
use TgBotLib\Methods\GetChatMember;
use TgBotLib\Methods\GetChatMemberCount;
use TgBotLib\Methods\GetFile;
use TgBotLib\Methods\GetForumTopicIconStickers;
use TgBotLib\Methods\GetMe;
use TgBotLib\Methods\GetUpdates;
use TgBotLib\Methods\GetUserProfilePhotos;
@ -128,6 +129,7 @@
case GET_CHAT_MEMBER = 'getChatMember';
case SET_CHAT_STICKER_SET = 'setChatStickerSet';
case DELETE_CHAT_STICKER_SET = 'deleteChatStickerSet';
case GET_FORUM_TOPIC_ICON_STICKERS = 'getForumTopicIconStickers';
/**
* Executes a command on the provided bot with the given parameters.
@ -201,6 +203,7 @@
self::GET_CHAT_MEMBER => GetChatMember::execute($bot, $parameters),
self::SET_CHAT_STICKER_SET => SetChatStickerSet::execute($bot, $parameters),
self::DELETE_CHAT_STICKER_SET => DeleteChatStickerSet::execute($bot, $parameters),
self::GET_FORUM_TOPIC_ICON_STICKERS => GetForumTopicIconStickers::execute($bot, $parameters),
};
}
}

View file

@ -0,0 +1,40 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Objects\ChatMember;
use TgBotLib\Objects\Stickers\Sticker;
class GetForumTopicIconStickers extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): array
{
return array_map(
fn($update) => Sticker::fromArray($update),
self::executeCurl(self::buildPost($bot, Methods::GET_FORUM_TOPIC_ICON_STICKERS->value, $parameters))
);
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return null;
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}