Add GetWebhookInfo method to fetch webhook info
This commit is contained in:
parent
e6f80ae85c
commit
547c19888a
2 changed files with 40 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
||||||
use TgBotLib\Methods\ForwardMessages;
|
use TgBotLib\Methods\ForwardMessages;
|
||||||
use TgBotLib\Methods\GetMe;
|
use TgBotLib\Methods\GetMe;
|
||||||
use TgBotLib\Methods\GetUpdates;
|
use TgBotLib\Methods\GetUpdates;
|
||||||
|
use TgBotLib\Methods\GetWebhookInfo;
|
||||||
use TgBotLib\Methods\Logout;
|
use TgBotLib\Methods\Logout;
|
||||||
use TgBotLib\Methods\SendAnimation;
|
use TgBotLib\Methods\SendAnimation;
|
||||||
use TgBotLib\Methods\SendAudio;
|
use TgBotLib\Methods\SendAudio;
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
case SEND_DICE = 'sendDice';
|
case SEND_DICE = 'sendDice';
|
||||||
case SEND_CHAT_ACTION = 'sendChatAction';
|
case SEND_CHAT_ACTION = 'sendChatAction';
|
||||||
case DELETE_WEBHOOK = 'deleteWebhook';
|
case DELETE_WEBHOOK = 'deleteWebhook';
|
||||||
|
case GET_WEBHOOK_INFO = 'getWebhookInfo';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -75,6 +77,8 @@
|
||||||
{
|
{
|
||||||
self::GET_UPDATES => GetUpdates::execute($bot, $parameters),
|
self::GET_UPDATES => GetUpdates::execute($bot, $parameters),
|
||||||
self::SET_WEBHOOK => SetWebhook::execute($bot, $parameters),
|
self::SET_WEBHOOK => SetWebhook::execute($bot, $parameters),
|
||||||
|
self::DELETE_WEBHOOK => DeleteWebhook::execute($bot, $parameters),
|
||||||
|
self::GET_WEBHOOK_INFO => GetWebhookInfo::execute($bot, $parameters),
|
||||||
self::GET_ME => GetMe::execute($bot, $parameters),
|
self::GET_ME => GetMe::execute($bot, $parameters),
|
||||||
self::LOGOUT => LogOut::execute($bot, $parameters),
|
self::LOGOUT => LogOut::execute($bot, $parameters),
|
||||||
self::CLOSE => Close::execute($bot, $parameters),
|
self::CLOSE => Close::execute($bot, $parameters),
|
||||||
|
@ -98,7 +102,6 @@
|
||||||
self::SEND_POLL => SendPoll::execute($bot, $parameters),
|
self::SEND_POLL => SendPoll::execute($bot, $parameters),
|
||||||
self::SEND_DICE => SendDice::execute($bot, $parameters),
|
self::SEND_DICE => SendDice::execute($bot, $parameters),
|
||||||
self::SEND_CHAT_ACTION => SendChatAction::execute($bot, $parameters),
|
self::SEND_CHAT_ACTION => SendChatAction::execute($bot, $parameters),
|
||||||
self::DELETE_WEBHOOK => DeleteWebhook::execute($bot, $parameters),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
36
src/TgBotLib/Methods/GetWebhookInfo.php
Normal file
36
src/TgBotLib/Methods/GetWebhookInfo.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
use TgBotLib\Objects\WebhookInfo;
|
||||||
|
|
||||||
|
class GetWebhookInfo extends Method
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): WebhookInfo
|
||||||
|
{
|
||||||
|
return WebhookInfo::fromArray(self::executeCurl(self::buildPost($bot, Methods::GET_WEBHOOK_INFO->value, $parameters)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue