Add CloseGeneralForumTopic method

This commit is contained in:
netkas 2024-11-07 00:51:09 -05:00
parent 175754649c
commit 9ea36578df
2 changed files with 40 additions and 0 deletions

View file

@ -10,6 +10,7 @@
use TgBotLib\Methods\BanChatSenderChat;
use TgBotLib\Methods\Close;
use TgBotLib\Methods\CloseForumTopic;
use TgBotLib\Methods\CloseGeneralForumTopic;
use TgBotLib\Methods\CopyMessage;
use TgBotLib\Methods\CopyMessages;
use TgBotLib\Methods\CreateChatInviteLink;
@ -144,6 +145,7 @@
case DELETE_FORUM_TOPIC = 'deleteForumTopic';
case UNPIN_ALLL_FORUM_TOPIC_MESSAGES = 'UnpinAllForumTopicMessages';
case EDIT_GENERAL_FORUM_TOPIC = 'editGeneralForumTopic';
case CLOSE_GENERAL_FORUM_TOPIC = 'closeGeneralForumTopic';
/**
* Executes a command on the provided bot with the given parameters.
@ -225,6 +227,7 @@
self::DELETE_FORUM_TOPIC => DeleteForumTopic::execute($bot, $parameters),
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),
};
}
}

View file

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