2024-11-06 14:59:07 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace TgBotLib\Methods;
|
|
|
|
|
|
|
|
use TgBotLib\Abstracts\Method;
|
|
|
|
use TgBotLib\Bot;
|
|
|
|
use TgBotLib\Enums\Methods;
|
|
|
|
use TgBotLib\Objects\ChatInviteLink;
|
|
|
|
|
|
|
|
class CreateChatInviteLink extends Method
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public static function execute(Bot $bot, array $parameters = []): ChatInviteLink
|
|
|
|
{
|
2024-11-06 15:10:25 -05:00
|
|
|
return ChatInviteLink::fromArray(
|
|
|
|
self::executeCurl(self::buildPost($bot, Methods::CREATE_CHAT_INVITE_LINK->value, $parameters))
|
|
|
|
);
|
2024-11-06 14:59:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public static function getRequiredParameters(): ?array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'chat_id'
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public static function getOptionalParameters(): ?array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'name',
|
|
|
|
'expire_date',
|
|
|
|
'member_limit',
|
|
|
|
'creates_join_request'
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|