Add ReopenForumTopic method

This commit is contained in:
netkas 2024-11-07 00:44:43 -05:00
parent 9e3d5dcaaf
commit cad5face2d
2 changed files with 41 additions and 0 deletions

View file

@ -39,6 +39,7 @@
use TgBotLib\Methods\Logout;
use TgBotLib\Methods\PinChatMessage;
use TgBotLib\Methods\PromoteChatMember;
use TgBotLib\Methods\ReopenForumTopic;
use TgBotLib\Methods\RestrictChatMember;
use TgBotLib\Methods\RevokeChatInviteLink;
use TgBotLib\Methods\SendAnimation;
@ -136,6 +137,7 @@
case CREATE_FORUM_TOPIC = 'createForumTopic';
case EDIT_FORUM_TOPIC = 'editForumTopic';
case CLOSE_FORUM_TOPIC = 'closeForumTopic';
case REOPEN_FORUM_TOPIC = 'reopenForumTopic';
/**
* Executes a command on the provided bot with the given parameters.
@ -213,6 +215,7 @@
self::CREATE_FORUM_TOPIC => CreateForumTopic::execute($bot, $parameters),
self::EDIT_FORUM_TOPIC => EditForumTopic::execute($bot, $parameters),
self::CLOSE_FORUM_TOPIC => CloseForumTopic::execute($bot, $parameters),
self::REOPEN_FORUM_TOPIC => ReopenForumTopic::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 ReopenForumTopic extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)(self::executeCurl(self::buildPost($bot, Methods::REOPEN_FORUM_TOPIC->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'message_thread_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}