From 1c32980541c89e567ed639f27c10cbf63ee14bc2 Mon Sep 17 00:00:00 2001 From: Netkas Date: Tue, 14 Feb 2023 21:14:18 -0500 Subject: [PATCH] Added method \TgBotLib > Bot > getWebhookInfo() --- src/TgBotLib/Bot.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/TgBotLib/Bot.php b/src/TgBotLib/Bot.php index 6dabf6c..44fdb3e 100644 --- a/src/TgBotLib/Bot.php +++ b/src/TgBotLib/Bot.php @@ -6,6 +6,7 @@ use TgBotLib\Exceptions\TelegramException; use TgBotLib\Objects\Telegram\Update; + use TgBotLib\Objects\Telegram\WebhookInfo; class Bot { @@ -201,4 +202,16 @@ return true; } + + /** + * Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo + * object. If the bot is using getUpdates, will return an object with the url field empty. + * + * @return WebhookInfo + * @throws TelegramException + */ + public function getWebhookInfo(): WebHookInfo + { + return WebhookInfo::fromArray($this->sendRequest('getWebhookInfo')); + } } \ No newline at end of file