Add GetMyDefaultAdministratorRights

This commit is contained in:
netkas 2024-11-13 21:50:11 -05:00
parent c61c37be02
commit e0543413e3
2 changed files with 41 additions and 0 deletions

View file

@ -40,6 +40,7 @@
use TgBotLib\Methods\GetForumTopicIconStickers;
use TgBotLib\Methods\GetMe;
use TgBotLib\Methods\GetMyCommands;
use TgBotLib\Methods\GetMyDefaultAdministratorRights;
use TgBotLib\Methods\GetMyDescription;
use TgBotLib\Methods\GetMyName;
use TgBotLib\Methods\GetMyShortDescription;
@ -184,6 +185,7 @@
case SET_CHAT_MENU_BUTTON = 'setChatMenuButton';
case GET_CHAT_MENU_BUTTON = 'getChatMenuButton';
case SET_MY_DEFAULT_ADMINISTRATOR_RIGHTS = 'setMyDefaultAdministratorRights';
case GET_MY_DEFAULT_ADMINISTRATOR_RIGHTS = 'getMyDefaultAdministratorRights';
/**
* Executes a command on the provided bot with the given parameters.
@ -285,6 +287,7 @@
self::SET_CHAT_MENU_BUTTON => SetChatMenuButton::execute($bot, $parameters),
self::GET_CHAT_MENU_BUTTON => GetChatMenuButton::execute($bot, $parameters),
self::SET_MY_DEFAULT_ADMINISTRATOR_RIGHTS => SetMyDefaultAdministratorRights::execute($bot, $parameters),
self::GET_MY_DEFAULT_ADMINISTRATOR_RIGHTS => GetMyDefaultAdministratorRights::execute($bot, $parameters),
};
}
}

View file

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