Add EditMessageReplyMarkup method
This commit is contained in:
parent
fe14ea249a
commit
91770ecbf6
2 changed files with 58 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
|||
use TgBotLib\Methods\EditMessageCaption;
|
||||
use TgBotLib\Methods\EditMessageLiveLocation;
|
||||
use TgBotLib\Methods\EditMessageMedia;
|
||||
use TgBotLib\Methods\EditMessageReplyMarkup;
|
||||
use TgBotLib\Methods\EditMessageText;
|
||||
use TgBotLib\Methods\ExportChatInviteLink;
|
||||
use TgBotLib\Methods\ForwardMessage;
|
||||
|
@ -196,6 +197,7 @@
|
|||
case EDIT_MESSAGE_MEDIA = 'editMessageMedia';
|
||||
case EDIT_MESSAGE_LIVE_LOCATION = 'editMessageLiveLocation';
|
||||
case STOP_MESSAGE_LIVE_LOCATION = 'stopMessageLiveLocation';
|
||||
case EDIT_MESSAGE_REPLY_MARKUP = 'editMessageReplyMarkup';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -303,6 +305,7 @@
|
|||
self::EDIT_MESSAGE_MEDIA => EditMessageMedia::execute($bot, $parameters),
|
||||
self::EDIT_MESSAGE_LIVE_LOCATION => EditMessageLiveLocation::execute($bot, $parameters),
|
||||
self::STOP_MESSAGE_LIVE_LOCATION => StopMessageLiveLocation::execute($bot, $parameters),
|
||||
self::EDIT_MESSAGE_REPLY_MARKUP => EditMessageReplyMarkup::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
55
src/TgBotLib/Methods/EditMessageReplyMarkup.php
Normal file
55
src/TgBotLib/Methods/EditMessageReplyMarkup.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Message;
|
||||
|
||||
class EditMessageReplyMarkup extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): Message
|
||||
{
|
||||
if (isset($parameters['reply_markup']))
|
||||
{
|
||||
if ($parameters['reply_markup'] instanceof ObjectTypeInterface)
|
||||
{
|
||||
$parameters['reply_markup'] = json_encode($parameters['reply_markup']->toArray());
|
||||
}
|
||||
elseif (is_array($parameters['reply_markup']))
|
||||
{
|
||||
$parameters['reply_markup'] = json_encode($parameters['reply_markup']);
|
||||
}
|
||||
}
|
||||
|
||||
return Message::fromArray(self::executeCurl(self::buildPost($bot, Methods::EDIT_MESSAGE_REPLY_MARKUP->value, $parameters)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'business_connection_id',
|
||||
'chat_id',
|
||||
'message_id',
|
||||
'inline_message_id',
|
||||
'reply_markup'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue