Add SetChatAdministratorCustomTitle method

This commit is contained in:
netkas 2024-11-06 00:16:34 -05:00
parent 47fde54d40
commit c535977bac
2 changed files with 42 additions and 0 deletions

View file

@ -36,6 +36,7 @@
use TgBotLib\Methods\SendVideo;
use TgBotLib\Methods\SendVideoNote;
use TgBotLib\Methods\SendVoice;
use TgBotLib\Methods\SetChatAdministratorCustomTitle;
use TgBotLib\Methods\SetMessageReaction;
use TgBotLib\Methods\SetWebhook;
use TgBotLib\Methods\UnbanChatMember;
@ -76,6 +77,7 @@
case UNBAN_CHAT_MEMBER = 'unbanChatMember';
case RESTRICT_CHAT_MEMBER = 'restrictChatMember';
case PROMOTE_CHAT_MEMBER = 'promoteChatMember';
case SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE = 'setChatAdministratorCustomTitle';
/**
* Executes a command on the provided bot with the given parameters.
@ -123,6 +125,7 @@
self::UNBAN_CHAT_MEMBER => UnbanChatMember::execute($bot, $parameters),
self::RESTRICT_CHAT_MEMBER => RestrictChatMember::execute($bot, $parameters),
self::PROMOTE_CHAT_MEMBER => PromoteChatMember::execute($bot, $parameters),
self::SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE => SetChatAdministratorCustomTitle::execute($bot, $parameters),
};
}
}

View file

@ -0,0 +1,39 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
class SetChatAdministratorCustomTitle extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)$bot->sendRequest(Methods::SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE->value, $parameters);
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'user_id',
'custom_title'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}