Add GetChatMenuButton method
This commit is contained in:
parent
61c73a13d1
commit
95020c9ed9
2 changed files with 41 additions and 0 deletions
|
@ -35,6 +35,7 @@
|
|||
use TgBotLib\Methods\GetChatAdministrators;
|
||||
use TgBotLib\Methods\GetChatMember;
|
||||
use TgBotLib\Methods\GetChatMemberCount;
|
||||
use TgBotLib\Methods\GetChatMenuButton;
|
||||
use TgBotLib\Methods\GetFile;
|
||||
use TgBotLib\Methods\GetForumTopicIconStickers;
|
||||
use TgBotLib\Methods\GetMe;
|
||||
|
@ -180,6 +181,7 @@
|
|||
case SET_MY_SHORT_DESCRIPTION = 'setMyShortDescription';
|
||||
case GET_MY_SHORT_DESCRIPTION = 'getMyShortDescription';
|
||||
case SET_CHAT_MENU_BUTTON = 'setChatMenuButton';
|
||||
case GET_CHAT_MENU_BUTTON = 'getChatMenuButton';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -279,6 +281,7 @@
|
|||
self::SET_MY_SHORT_DESCRIPTION => SetMyShortDescription::execute($bot, $parameters),
|
||||
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),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
38
src/TgBotLib/Methods/GetChatMenuButton.php
Normal file
38
src/TgBotLib/Methods/GetChatMenuButton.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
use TgBotLib\Objects\MenuButton;
|
||||
|
||||
class GetChatMenuButton extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): MenuButton
|
||||
{
|
||||
return MenuButton::fromArray(self::executeCurl(self::buildPost($bot, Methods::GET_CHAT_MENU_BUTTON->value, $parameters)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue