Add GetUserChatBoosts method

This commit is contained in:
netkas 2024-11-07 01:01:06 -05:00
parent be210c5411
commit 69f796b951
2 changed files with 44 additions and 0 deletions

View file

@ -37,6 +37,7 @@
use TgBotLib\Methods\GetForumTopicIconStickers;
use TgBotLib\Methods\GetMe;
use TgBotLib\Methods\GetUpdates;
use TgBotLib\Methods\GetUserChatBoosts;
use TgBotLib\Methods\GetUserProfilePhotos;
use TgBotLib\Methods\GetWebhookInfo;
use TgBotLib\Methods\HideGeneralForumTopic;
@ -156,6 +157,7 @@
case UNHIDE_GENERAL_FORUM_TOPIC = 'unhideGeneralForumTopic';
case UNPIN_ALL_GENERAL_FORUM_TOPIC_MESSAGES = 'unpinAllGeneralForumTopicMessages';
case ANSWER_CALLBACK_QUERY = 'answerCallbackQuery';
case GET_USER_CHAT_BOOSTS = 'getUserChatBoosts';
/**
* Executes a command on the provided bot with the given parameters.
@ -243,6 +245,7 @@
self::UNHIDE_GENERAL_FORUM_TOPIC => UnhideGeneralForumTopic::execute($bot, $parameters),
self::UNPIN_ALL_GENERAL_FORUM_TOPIC_MESSAGES => UnpinAllGeneralForumTopicMessages::execute($bot, $parameters),
self::ANSWER_CALLBACK_QUERY => AnswerCallbackQuery::execute($bot, $parameters),
self::GET_USER_CHAT_BOOSTS => GetUserChatBoosts::execute($bot, $parameters),
};
}
}

View file

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