Add EditForumTopic Method

This commit is contained in:
netkas 2024-11-06 19:28:26 -05:00
parent 530cc3e402
commit 588d1b099d
2 changed files with 47 additions and 1 deletions

View file

@ -13,12 +13,14 @@
use TgBotLib\Methods\CopyMessages;
use TgBotLib\Methods\CreateChatInviteLink;
use TgBotLib\Methods\CreateChatSubscriptionInviteLink;
use TgBotLib\Methods\CreateForumTopic;
use TgBotLib\Methods\DeclineChatJoinRequest;
use TgBotLib\Methods\DeleteChatPhoto;
use TgBotLib\Methods\DeleteChatStickerSet;
use TgBotLib\Methods\DeleteWebhook;
use TgBotLib\Methods\EditChatInviteLink;
use TgBotLib\Methods\EditChatSubscriptionInviteLink;
use TgBotLib\Methods\EditForumTopic;
use TgBotLib\Methods\ExportChatInviteLink;
use TgBotLib\Methods\ForwardMessage;
use TgBotLib\Methods\ForwardMessages;
@ -131,6 +133,7 @@
case DELETE_CHAT_STICKER_SET = 'deleteChatStickerSet';
case GET_FORUM_TOPIC_ICON_STICKERS = 'getForumTopicIconStickers';
case CREATE_FORUM_TOPIC = 'createForumTopic';
case EDIT_FORUM_TOPIC = 'editForumTopic';
/**
* Executes a command on the provided bot with the given parameters.
@ -205,7 +208,8 @@
self::SET_CHAT_STICKER_SET => SetChatStickerSet::execute($bot, $parameters),
self::DELETE_CHAT_STICKER_SET => DeleteChatStickerSet::execute($bot, $parameters),
self::GET_FORUM_TOPIC_ICON_STICKERS => GetForumTopicIconStickers::execute($bot, $parameters),
self::CREATE_FORUM_TOPIC => CreateChatSubscriptionInviteLink::execute($bot, $parameters),
self::CREATE_FORUM_TOPIC => CreateForumTopic::execute($bot, $parameters),
self::EDIT_FORUM_TOPIC => EditForumTopic::execute($bot, $parameters),
};
}
}

View file

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