Add DeleteForumTopic method

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

View file

@ -18,6 +18,7 @@
use TgBotLib\Methods\DeclineChatJoinRequest;
use TgBotLib\Methods\DeleteChatPhoto;
use TgBotLib\Methods\DeleteChatStickerSet;
use TgBotLib\Methods\DeleteForumTopic;
use TgBotLib\Methods\DeleteWebhook;
use TgBotLib\Methods\EditChatInviteLink;
use TgBotLib\Methods\EditChatSubscriptionInviteLink;
@ -138,6 +139,7 @@
case EDIT_FORUM_TOPIC = 'editForumTopic';
case CLOSE_FORUM_TOPIC = 'closeForumTopic';
case REOPEN_FORUM_TOPIC = 'reopenForumTopic';
case DELETE_FORUM_TOPIC = 'deleteForumTopic';
/**
* Executes a command on the provided bot with the given parameters.
@ -216,6 +218,7 @@
self::EDIT_FORUM_TOPIC => EditForumTopic::execute($bot, $parameters),
self::CLOSE_FORUM_TOPIC => CloseForumTopic::execute($bot, $parameters),
self::REOPEN_FORUM_TOPIC => ReopenForumTopic::execute($bot, $parameters),
self::DELETE_FORUM_TOPIC => DeleteForumTopic::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 DeleteForumTopic extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)(self::executeCurl(self::buildPost($bot, Methods::DELETE_FORUM_TOPIC->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'message_thread_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}