Add CreateForumTopic method to TgBotLib
This commit is contained in:
parent
4accf1713c
commit
530cc3e402
2 changed files with 44 additions and 0 deletions
|
@ -130,6 +130,7 @@
|
||||||
case SET_CHAT_STICKER_SET = 'setChatStickerSet';
|
case SET_CHAT_STICKER_SET = 'setChatStickerSet';
|
||||||
case DELETE_CHAT_STICKER_SET = 'deleteChatStickerSet';
|
case DELETE_CHAT_STICKER_SET = 'deleteChatStickerSet';
|
||||||
case GET_FORUM_TOPIC_ICON_STICKERS = 'getForumTopicIconStickers';
|
case GET_FORUM_TOPIC_ICON_STICKERS = 'getForumTopicIconStickers';
|
||||||
|
case CREATE_FORUM_TOPIC = 'createForumTopic';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -204,6 +205,7 @@
|
||||||
self::SET_CHAT_STICKER_SET => SetChatStickerSet::execute($bot, $parameters),
|
self::SET_CHAT_STICKER_SET => SetChatStickerSet::execute($bot, $parameters),
|
||||||
self::DELETE_CHAT_STICKER_SET => DeleteChatStickerSet::execute($bot, $parameters),
|
self::DELETE_CHAT_STICKER_SET => DeleteChatStickerSet::execute($bot, $parameters),
|
||||||
self::GET_FORUM_TOPIC_ICON_STICKERS => GetForumTopicIconStickers::execute($bot, $parameters),
|
self::GET_FORUM_TOPIC_ICON_STICKERS => GetForumTopicIconStickers::execute($bot, $parameters),
|
||||||
|
self::CREATE_FORUM_TOPIC => CreateChatSubscriptionInviteLink::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
42
src/TgBotLib/Methods/CreateForumTopic.php
Normal file
42
src/TgBotLib/Methods/CreateForumTopic.php
Normal 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 CreateForumTopic extends Method
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): ForumTopic
|
||||||
|
{
|
||||||
|
return ForumTopic::fromArray(self::executeCurl(self::buildPost($bot, Methods::CREATE_FORUM_TOPIC->value, $parameters)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'chat_id',
|
||||||
|
'name'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'icon_color',
|
||||||
|
'icon_custom_emoji_id'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue