Add 'HideGeneralForumTopic' method

This commit is contained in:
netkas 2024-11-07 00:54:14 -05:00
parent 89af7589cb
commit 18bd8ce69e
2 changed files with 40 additions and 0 deletions

View file

@ -38,6 +38,7 @@
use TgBotLib\Methods\GetUpdates;
use TgBotLib\Methods\GetUserProfilePhotos;
use TgBotLib\Methods\GetWebhookInfo;
use TgBotLib\Methods\HideGeneralForumTopic;
use TgBotLib\Methods\LeaveChat;
use TgBotLib\Methods\Logout;
use TgBotLib\Methods\PinChatMessage;
@ -148,6 +149,7 @@
case EDIT_GENERAL_FORUM_TOPIC = 'editGeneralForumTopic';
case CLOSE_GENERAL_FORUM_TOPIC = 'closeGeneralForumTopic';
case REOPEN_GENERAL_FORUM_TOPIC = 'reopenGeneralForumTopic';
case HIDE_GENERAL_FORUM_TOPIC = 'hideGeneralForumTopic';
/**
* Executes a command on the provided bot with the given parameters.
@ -231,6 +233,7 @@
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),
self::HIDE_GENERAL_FORUM_TOPIC => HideGeneralForumTopic::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 HideGeneralForumTopic extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)(self::executeCurl(self::buildPost($bot, Methods::HIDE_GENERAL_FORUM_TOPIC->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}