Add unpinAllGeneralForumTopicMessages method

This commit is contained in:
netkas 2024-11-07 00:57:23 -05:00
parent ec7c4b5882
commit 17369210d5
2 changed files with 40 additions and 0 deletions

View file

@ -76,6 +76,7 @@
use TgBotLib\Methods\UnhideGeneralForumTopic;
use TgBotLib\Methods\UnpinAllChatMessages;
use TgBotLib\Methods\UnpinAllForumTopicMessages;
use TgBotLib\Methods\UnpinAllGeneralForumTopicMessages;
use TgBotLib\Methods\UnpinChatMessage;
enum Methods : string
@ -152,6 +153,7 @@
case REOPEN_GENERAL_FORUM_TOPIC = 'reopenGeneralForumTopic';
case HIDE_GENERAL_FORUM_TOPIC = 'hideGeneralForumTopic';
case UNHIDE_GENERAL_FORUM_TOPIC = 'unhideGeneralForumTopic';
case UNPIN_ALL_GENERAL_FORUM_TOPIC_MESSAGES = 'unpinAllGeneralForumTopicMessages';
/**
* Executes a command on the provided bot with the given parameters.
@ -237,6 +239,7 @@
self::REOPEN_GENERAL_FORUM_TOPIC => ReopenGeneralForumTopic::execute($bot, $parameters),
self::HIDE_GENERAL_FORUM_TOPIC => HideGeneralForumTopic::execute($bot, $parameters),
self::UNHIDE_GENERAL_FORUM_TOPIC => UnhideGeneralForumTopic::execute($bot, $parameters),
self::UNPIN_ALL_GENERAL_FORUM_TOPIC_MESSAGES => UnpinAllGeneralForumTopicMessages::execute($bot, $parameters),
};
}
}

View file

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