Add CloseForumTopic method

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

View file

@ -9,6 +9,7 @@
use TgBotLib\Methods\BanChatMember;
use TgBotLib\Methods\BanChatSenderChat;
use TgBotLib\Methods\Close;
use TgBotLib\Methods\CloseForumTopic;
use TgBotLib\Methods\CopyMessage;
use TgBotLib\Methods\CopyMessages;
use TgBotLib\Methods\CreateChatInviteLink;
@ -134,6 +135,7 @@
case GET_FORUM_TOPIC_ICON_STICKERS = 'getForumTopicIconStickers';
case CREATE_FORUM_TOPIC = 'createForumTopic';
case EDIT_FORUM_TOPIC = 'editForumTopic';
case CLOSE_FORUM_TOPIC = 'closeForumTopic';
/**
* Executes a command on the provided bot with the given parameters.
@ -210,6 +212,7 @@
self::GET_FORUM_TOPIC_ICON_STICKERS => GetForumTopicIconStickers::execute($bot, $parameters),
self::CREATE_FORUM_TOPIC => CreateForumTopic::execute($bot, $parameters),
self::EDIT_FORUM_TOPIC => EditForumTopic::execute($bot, $parameters),
self::CLOSE_FORUM_TOPIC => CloseForumTopic::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 CloseForumTopic extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)(self::executeCurl(self::buildPost($bot, Methods::CLOSE_FORUM_TOPIC->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'message_thread_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}