Refactor execute method to return Message object

This commit is contained in:
netkas 2024-11-14 00:28:12 -05:00
parent 91770ecbf6
commit 491137d5a4

View file

@ -6,6 +6,7 @@
use TgBotLib\Bot; use TgBotLib\Bot;
use TgBotLib\Enums\Methods; use TgBotLib\Enums\Methods;
use TgBotLib\Interfaces\ObjectTypeInterface; use TgBotLib\Interfaces\ObjectTypeInterface;
use TgBotLib\Objects\Message;
class StopMessageLiveLocation extends Method class StopMessageLiveLocation extends Method
{ {
@ -13,7 +14,7 @@
/** /**
* @inheritDoc * @inheritDoc
*/ */
public static function execute(Bot $bot, array $parameters = []): mixed public static function execute(Bot $bot, array $parameters = []): Message
{ {
if (isset($parameters['reply_markup'])) if (isset($parameters['reply_markup']))
{ {
@ -27,7 +28,7 @@
} }
} }
return self::executeCurl(self::buildPost($bot, Methods::STOP_MESSAGE_LIVE_LOCATION->value, $parameters)); return Message::fromArray(self::executeCurl(self::buildPost($bot, Methods::STOP_MESSAGE_LIVE_LOCATION->value, $parameters)));
} }
/** /**