Add StopMessageLiveLocation method
This commit is contained in:
parent
fccb461e34
commit
fe14ea249a
2 changed files with 57 additions and 0 deletions
|
@ -91,6 +91,7 @@
|
||||||
use TgBotLib\Methods\SetMyName;
|
use TgBotLib\Methods\SetMyName;
|
||||||
use TgBotLib\Methods\SetMyShortDescription;
|
use TgBotLib\Methods\SetMyShortDescription;
|
||||||
use TgBotLib\Methods\SetWebhook;
|
use TgBotLib\Methods\SetWebhook;
|
||||||
|
use TgBotLib\Methods\StopMessageLiveLocation;
|
||||||
use TgBotLib\Methods\UnbanChatMember;
|
use TgBotLib\Methods\UnbanChatMember;
|
||||||
use TgBotLib\Methods\UnbanChatSenderChat;
|
use TgBotLib\Methods\UnbanChatSenderChat;
|
||||||
use TgBotLib\Methods\UnhideGeneralForumTopic;
|
use TgBotLib\Methods\UnhideGeneralForumTopic;
|
||||||
|
@ -194,6 +195,7 @@
|
||||||
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';
|
case EDIT_MESSAGE_LIVE_LOCATION = 'editMessageLiveLocation';
|
||||||
|
case STOP_MESSAGE_LIVE_LOCATION = 'stopMessageLiveLocation';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -300,6 +302,7 @@
|
||||||
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),
|
self::EDIT_MESSAGE_LIVE_LOCATION => EditMessageLiveLocation::execute($bot, $parameters),
|
||||||
|
self::STOP_MESSAGE_LIVE_LOCATION => StopMessageLiveLocation::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
54
src/TgBotLib/Methods/StopMessageLiveLocation.php
Normal file
54
src/TgBotLib/Methods/StopMessageLiveLocation.php
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||||
|
|
||||||
|
class StopMessageLiveLocation extends Method
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): mixed
|
||||||
|
{
|
||||||
|
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 self::executeCurl(self::buildPost($bot, Methods::STOP_MESSAGE_LIVE_LOCATION->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