Add UnpinAllForumTopicMessages method

This commit is contained in:
netkas 2024-11-07 00:48:08 -05:00
parent 44dfe821c1
commit 524475a757
2 changed files with 41 additions and 0 deletions

View file

@ -70,6 +70,7 @@
use TgBotLib\Methods\UnbanChatMember;
use TgBotLib\Methods\UnbanChatSenderChat;
use TgBotLib\Methods\UnpinAllChatMessages;
use TgBotLib\Methods\UnpinAllForumTopicMessages;
use TgBotLib\Methods\UnpinChatMessage;
enum Methods : string
@ -140,6 +141,7 @@
case CLOSE_FORUM_TOPIC = 'closeForumTopic';
case REOPEN_FORUM_TOPIC = 'reopenForumTopic';
case DELETE_FORUM_TOPIC = 'deleteForumTopic';
case UNPIN_ALLL_FORUM_TOPIC_MESSAGES = 'UnpinAllForumTopicMessages';
/**
* Executes a command on the provided bot with the given parameters.
@ -219,6 +221,7 @@
self::CLOSE_FORUM_TOPIC => CloseForumTopic::execute($bot, $parameters),
self::REOPEN_FORUM_TOPIC => ReopenForumTopic::execute($bot, $parameters),
self::DELETE_FORUM_TOPIC => DeleteForumTopic::execute($bot, $parameters),
self::UNPIN_ALLL_FORUM_TOPIC_MESSAGES => UnpinAllForumTopicMessages::execute($bot, $parameters),
};
}
}

View file

@ -0,0 +1,38 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
class UnpinAllForumTopicMessages extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)(self::executeCurl(self::buildPost($bot, Methods::UNPIN_ALLL_FORUM_TOPIC_MESSAGES->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'message_thread_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}