Add EditMessageLiveLocation method
This commit is contained in:
parent
fe42f8747f
commit
fccb461e34
2 changed files with 65 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
||||||
use TgBotLib\Methods\EditForumTopic;
|
use TgBotLib\Methods\EditForumTopic;
|
||||||
use TgBotLib\Methods\EditGeneralForumTopic;
|
use TgBotLib\Methods\EditGeneralForumTopic;
|
||||||
use TgBotLib\Methods\EditMessageCaption;
|
use TgBotLib\Methods\EditMessageCaption;
|
||||||
|
use TgBotLib\Methods\EditMessageLiveLocation;
|
||||||
use TgBotLib\Methods\EditMessageMedia;
|
use TgBotLib\Methods\EditMessageMedia;
|
||||||
use TgBotLib\Methods\EditMessageText;
|
use TgBotLib\Methods\EditMessageText;
|
||||||
use TgBotLib\Methods\ExportChatInviteLink;
|
use TgBotLib\Methods\ExportChatInviteLink;
|
||||||
|
@ -192,6 +193,7 @@
|
||||||
case EDIT_MESSAGE_TEXT = 'editMessageText';
|
case EDIT_MESSAGE_TEXT = 'editMessageText';
|
||||||
case EDIT_MESSAGE_CAPTION = 'editMessageCaption';
|
case EDIT_MESSAGE_CAPTION = 'editMessageCaption';
|
||||||
case EDIT_MESSAGE_MEDIA = 'editMessageMedia';
|
case EDIT_MESSAGE_MEDIA = 'editMessageMedia';
|
||||||
|
case EDIT_MESSAGE_LIVE_LOCATION = 'editMessageLiveLocation';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -297,6 +299,7 @@
|
||||||
self::EDIT_MESSAGE_TEXT => EditMessageText::execute($bot, $parameters),
|
self::EDIT_MESSAGE_TEXT => EditMessageText::execute($bot, $parameters),
|
||||||
self::EDIT_MESSAGE_CAPTION => EditMessageCaption::execute($bot, $parameters),
|
self::EDIT_MESSAGE_CAPTION => EditMessageCaption::execute($bot, $parameters),
|
||||||
self::EDIT_MESSAGE_MEDIA => EditMessageMedia::execute($bot, $parameters),
|
self::EDIT_MESSAGE_MEDIA => EditMessageMedia::execute($bot, $parameters),
|
||||||
|
self::EDIT_MESSAGE_LIVE_LOCATION => EditMessageLiveLocation::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
62
src/TgBotLib/Methods/EditMessageLiveLocation.php
Normal file
62
src/TgBotLib/Methods/EditMessageLiveLocation.php
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||||
|
use TgBotLib\Objects\Message;
|
||||||
|
|
||||||
|
class EditMessageLiveLocation 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_LIVE_LOCATION->value, $parameters)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'latitude',
|
||||||
|
'longitude',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'business_connection_id',
|
||||||
|
'chat_id',
|
||||||
|
'message_id',
|
||||||
|
'inline_message_id',
|
||||||
|
'live_period',
|
||||||
|
'horizontal_accuracy',
|
||||||
|
'heading',
|
||||||
|
'proximity_alert_radius',
|
||||||
|
'reply_markup'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue