Add SetChatMenuButton method
This commit is contained in:
parent
50d6ddd152
commit
61c73a13d1
2 changed files with 47 additions and 0 deletions
|
@ -73,6 +73,7 @@
|
||||||
use TgBotLib\Methods\SendVoice;
|
use TgBotLib\Methods\SendVoice;
|
||||||
use TgBotLib\Methods\SetChatAdministratorCustomTitle;
|
use TgBotLib\Methods\SetChatAdministratorCustomTitle;
|
||||||
use TgBotLib\Methods\SetChatDescription;
|
use TgBotLib\Methods\SetChatDescription;
|
||||||
|
use TgBotLib\Methods\SetChatMenuButton;
|
||||||
use TgBotLib\Methods\SetChatPermissions;
|
use TgBotLib\Methods\SetChatPermissions;
|
||||||
use TgBotLib\Methods\SetChatPhoto;
|
use TgBotLib\Methods\SetChatPhoto;
|
||||||
use TgBotLib\Methods\SetChatStickerSet;
|
use TgBotLib\Methods\SetChatStickerSet;
|
||||||
|
@ -178,6 +179,7 @@
|
||||||
case GET_MY_DESCRIPTION = 'getMyDescription';
|
case GET_MY_DESCRIPTION = 'getMyDescription';
|
||||||
case SET_MY_SHORT_DESCRIPTION = 'setMyShortDescription';
|
case SET_MY_SHORT_DESCRIPTION = 'setMyShortDescription';
|
||||||
case GET_MY_SHORT_DESCRIPTION = 'getMyShortDescription';
|
case GET_MY_SHORT_DESCRIPTION = 'getMyShortDescription';
|
||||||
|
case SET_CHAT_MENU_BUTTON = 'setChatMenuButton';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -276,6 +278,7 @@
|
||||||
self::GET_MY_DESCRIPTION => GetMyDescription::execute($bot, $parameters),
|
self::GET_MY_DESCRIPTION => GetMyDescription::execute($bot, $parameters),
|
||||||
self::SET_MY_SHORT_DESCRIPTION => SetMyShortDescription::execute($bot, $parameters),
|
self::SET_MY_SHORT_DESCRIPTION => SetMyShortDescription::execute($bot, $parameters),
|
||||||
self::GET_MY_SHORT_DESCRIPTION => GetMyShortDescription::execute($bot, $parameters),
|
self::GET_MY_SHORT_DESCRIPTION => GetMyShortDescription::execute($bot, $parameters),
|
||||||
|
self::SET_CHAT_MENU_BUTTON => SetChatMenuButton::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
44
src/TgBotLib/Methods/SetChatMenuButton.php
Normal file
44
src/TgBotLib/Methods/SetChatMenuButton.php
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||||
|
|
||||||
|
class SetChatMenuButton extends Method
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): mixed
|
||||||
|
{
|
||||||
|
if(isset($parameters['menu_button']) && $parameters['menu_button'] instanceof ObjectTypeInterface)
|
||||||
|
{
|
||||||
|
$parameters['menu_button'] = json_encode($parameters['menu_button']->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::executeCurl(self::buildPost($bot, Methods::SET_CHAT_MENU_BUTTON->value, $parameters));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'chat_id',
|
||||||
|
'menu_button'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue