Add SetChatStickerSet method

This commit is contained in:
netkas 2024-11-06 19:21:23 -05:00
parent 4893a23bfa
commit f000bc422d
2 changed files with 41 additions and 0 deletions

View file

@ -56,6 +56,7 @@
use TgBotLib\Methods\SetChatDescription;
use TgBotLib\Methods\SetChatPermissions;
use TgBotLib\Methods\SetChatPhoto;
use TgBotLib\Methods\SetChatStickerSet;
use TgBotLib\Methods\SetChatTitle;
use TgBotLib\Methods\SetMessageReaction;
use TgBotLib\Methods\SetWebhook;
@ -124,6 +125,7 @@
case GET_CHAT_ADMINISTRATORS = 'getChatAdministrators';
case GET_CHAT_MEMBER_COUNT = 'getChatMemberCount';
case GET_CHAT_MEMBER = 'getChatMember';
case SET_CHAT_STICKER_SET = 'setChatStickerSet';
/**
* Executes a command on the provided bot with the given parameters.
@ -195,6 +197,7 @@
self::GET_CHAT_ADMINISTRATORS => GetChatAdministrators::execute($bot, $parameters),
self::GET_CHAT_MEMBER_COUNT => GetChatMemberCount::execute($bot, $parameters),
self::GET_CHAT_MEMBER => GetChatMember::execute($bot, $parameters),
self::SET_CHAT_STICKER_SET => SetChatStickerSet::execute($bot, $parameters),
};
}
}

View file

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