Add SetMyDefaultAdministratorRights
This commit is contained in:
parent
95020c9ed9
commit
c61c37be02
2 changed files with 46 additions and 0 deletions
|
@ -81,6 +81,7 @@
|
|||
use TgBotLib\Methods\SetChatTitle;
|
||||
use TgBotLib\Methods\SetMessageReaction;
|
||||
use TgBotLib\Methods\SetMyCommands;
|
||||
use TgBotLib\Methods\SetMyDefaultAdministratorRights;
|
||||
use TgBotLib\Methods\SetMyDescription;
|
||||
use TgBotLib\Methods\SetMyName;
|
||||
use TgBotLib\Methods\SetMyShortDescription;
|
||||
|
@ -182,6 +183,7 @@
|
|||
case GET_MY_SHORT_DESCRIPTION = 'getMyShortDescription';
|
||||
case SET_CHAT_MENU_BUTTON = 'setChatMenuButton';
|
||||
case GET_CHAT_MENU_BUTTON = 'getChatMenuButton';
|
||||
case SET_MY_DEFAULT_ADMINISTRATOR_RIGHTS = 'setMyDefaultAdministratorRights';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -282,6 +284,7 @@
|
|||
self::GET_MY_SHORT_DESCRIPTION => GetMyShortDescription::execute($bot, $parameters),
|
||||
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),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
43
src/TgBotLib/Methods/SetMyDefaultAdministratorRights.php
Normal file
43
src/TgBotLib/Methods/SetMyDefaultAdministratorRights.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class SetMyDefaultAdministratorRights extends Method
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): bool
|
||||
{
|
||||
if(isset($parameters['rights']) && $parameters['rights'] instanceof ObjectTypeInterface)
|
||||
{
|
||||
$parameters['rights'] = json_encode($parameters['rights']->toArray());
|
||||
}
|
||||
|
||||
return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_MY_DEFAULT_ADMINISTRATOR_RIGHTS->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'rights',
|
||||
'for_channels'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue