Add CreateChatInviteLink method to the library
This commit is contained in:
parent
2f2fefbe9d
commit
6315f5840d
2 changed files with 45 additions and 0 deletions
42
src/TgBotLib/Methods/CreateChatInviteLink.php
Normal file
42
src/TgBotLib/Methods/CreateChatInviteLink.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\ChatInviteLink;
|
||||
|
||||
class CreateChatInviteLink extends Method
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): ChatInviteLink
|
||||
{
|
||||
return ChatInviteLink::fromArray($bot->sendRequest(Methods::CREATE_CHAT_INVITE_LINK->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'name',
|
||||
'expire_date',
|
||||
'member_limit',
|
||||
'creates_join_request'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue