Add DeleteWebhook method to handle webhook deletions
This commit is contained in:
parent
e7f89d7e0d
commit
76b6590f79
2 changed files with 40 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
||||||
use TgBotLib\Methods\Close;
|
use TgBotLib\Methods\Close;
|
||||||
use TgBotLib\Methods\CopyMessage;
|
use TgBotLib\Methods\CopyMessage;
|
||||||
use TgBotLib\Methods\CopyMessages;
|
use TgBotLib\Methods\CopyMessages;
|
||||||
|
use TgBotLib\Methods\DeleteWebhook;
|
||||||
use TgBotLib\Methods\ForwardMessage;
|
use TgBotLib\Methods\ForwardMessage;
|
||||||
use TgBotLib\Methods\ForwardMessages;
|
use TgBotLib\Methods\ForwardMessages;
|
||||||
use TgBotLib\Methods\GetMe;
|
use TgBotLib\Methods\GetMe;
|
||||||
|
@ -58,6 +59,7 @@
|
||||||
case SEND_POLL = 'sendPoll';
|
case SEND_POLL = 'sendPoll';
|
||||||
case SEND_DICE = 'sendDice';
|
case SEND_DICE = 'sendDice';
|
||||||
case SEND_CHAT_ACTION = 'sendChatAction';
|
case SEND_CHAT_ACTION = 'sendChatAction';
|
||||||
|
case DELETE_WEBHOOK = 'deleteWebhook';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -95,7 +97,8 @@
|
||||||
self::SEND_CONTACT => SendContact::execute($bot, $parameters),
|
self::SEND_CONTACT => SendContact::execute($bot, $parameters),
|
||||||
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/DeleteWebhook.php
Normal file
36
src/TgBotLib/Methods/DeleteWebhook.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
|
||||||
|
class DeleteWebhook extends Method
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): mixed
|
||||||
|
{
|
||||||
|
return self::executeCurl(self::buildPost($bot, Methods::DELETE_WEBHOOK->value, $parameters));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'drop_pending_updates'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue