Add ReopenGeneralForumTopic method

This commit is contained in:
netkas 2024-11-07 00:52:20 -05:00
parent 9ea36578df
commit 89af7589cb
2 changed files with 40 additions and 0 deletions

View file

@ -43,6 +43,7 @@
use TgBotLib\Methods\PinChatMessage;
use TgBotLib\Methods\PromoteChatMember;
use TgBotLib\Methods\ReopenForumTopic;
use TgBotLib\Methods\ReopenGeneralForumTopic;
use TgBotLib\Methods\RestrictChatMember;
use TgBotLib\Methods\RevokeChatInviteLink;
use TgBotLib\Methods\SendAnimation;
@ -146,6 +147,7 @@
case UNPIN_ALLL_FORUM_TOPIC_MESSAGES = 'UnpinAllForumTopicMessages';
case EDIT_GENERAL_FORUM_TOPIC = 'editGeneralForumTopic';
case CLOSE_GENERAL_FORUM_TOPIC = 'closeGeneralForumTopic';
case REOPEN_GENERAL_FORUM_TOPIC = 'reopenGeneralForumTopic';
/**
* Executes a command on the provided bot with the given parameters.
@ -228,6 +230,7 @@
self::UNPIN_ALLL_FORUM_TOPIC_MESSAGES => UnpinAllForumTopicMessages::execute($bot, $parameters),
self::EDIT_GENERAL_FORUM_TOPIC => EditGeneralForumTopic::execute($bot, $parameters),
self::CLOSE_GENERAL_FORUM_TOPIC => CloseGeneralForumTopic::execute($bot, $parameters),
self::REOPEN_GENERAL_FORUM_TOPIC => ReopenGeneralForumTopic::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 ReopenGeneralForumTopic extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): mixed
{
return (bool)(self::executeCurl(self::buildPost($bot, Methods::REOPEN_GENERAL_FORUM_TOPIC->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}