Add unpinAllChatMessages method
This commit is contained in:
parent
94d8922a49
commit
7ee714b36c
2 changed files with 40 additions and 0 deletions
|
@ -56,6 +56,7 @@
|
|||
use TgBotLib\Methods\SetWebhook;
|
||||
use TgBotLib\Methods\UnbanChatMember;
|
||||
use TgBotLib\Methods\UnbanChatSenderChat;
|
||||
use TgBotLib\Methods\UnpinAllChatMessages;
|
||||
use TgBotLib\Methods\UnpinChatMessage;
|
||||
|
||||
enum Methods : string
|
||||
|
@ -112,6 +113,7 @@
|
|||
case SET_CHAT_DESCRIPTION = 'setChatDescription';
|
||||
case PIN_CHAT_MESSAGE = 'pinChatMessage';
|
||||
case UNPIN_CHAT_MESSAGE = 'unpinChatMessage';
|
||||
case UNPIN_ALL_CHAT_MESSAGES = 'unpinAllChatMessages';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -177,6 +179,7 @@
|
|||
self::SET_CHAT_DESCRIPTION => SetChatDescription::execute($bot, $parameters),
|
||||
self::PIN_CHAT_MESSAGE => PinChatMessage::execute($bot, $parameters),
|
||||
self::UNPIN_CHAT_MESSAGE => UnpinChatMessage::execute($bot, $parameters),
|
||||
self::UNPIN_ALL_CHAT_MESSAGES => UnpinAllChatMessages::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
37
src/TgBotLib/Methods/UnpinAllChatMessages.php
Normal file
37
src/TgBotLib/Methods/UnpinAllChatMessages.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
|
||||
class UnpinAllChatMessages extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
return (bool)self::executeCurl(self::buildPost($bot, Methods::UNPIN_ALL_CHAT_MESSAGES->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue