Add CreateChatInviteLink method to the library
This commit is contained in:
parent
2f2fefbe9d
commit
6315f5840d
2 changed files with 45 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
use TgBotLib\Methods\Close;
|
use TgBotLib\Methods\Close;
|
||||||
use TgBotLib\Methods\CopyMessage;
|
use TgBotLib\Methods\CopyMessage;
|
||||||
use TgBotLib\Methods\CopyMessages;
|
use TgBotLib\Methods\CopyMessages;
|
||||||
|
use TgBotLib\Methods\CreateChatInviteLink;
|
||||||
use TgBotLib\Methods\DeleteWebhook;
|
use TgBotLib\Methods\DeleteWebhook;
|
||||||
use TgBotLib\Methods\ExportChatInviteLink;
|
use TgBotLib\Methods\ExportChatInviteLink;
|
||||||
use TgBotLib\Methods\ForwardMessage;
|
use TgBotLib\Methods\ForwardMessage;
|
||||||
|
@ -86,6 +87,7 @@
|
||||||
case UNBAN_CHAT_SENDER_CHAT = 'unbanChatSenderChat';
|
case UNBAN_CHAT_SENDER_CHAT = 'unbanChatSenderChat';
|
||||||
case SET_CHAT_PERMISSIONS = 'setChatPermissions';
|
case SET_CHAT_PERMISSIONS = 'setChatPermissions';
|
||||||
case EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink';
|
case EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink';
|
||||||
|
case CREATE_CHAT_INVITE_LINK = 'createChatInviteLink';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -138,6 +140,7 @@
|
||||||
self::UNBAN_CHAT_SENDER_CHAT => UnbanChatSenderChat::execute($bot, $parameters),
|
self::UNBAN_CHAT_SENDER_CHAT => UnbanChatSenderChat::execute($bot, $parameters),
|
||||||
self::SET_CHAT_PERMISSIONS => SetChatPermissions::execute($bot, $parameters),
|
self::SET_CHAT_PERMISSIONS => SetChatPermissions::execute($bot, $parameters),
|
||||||
self::EXPORT_CHAT_INVITE_LINK => ExportChatInviteLink::execute($bot, $parameters),
|
self::EXPORT_CHAT_INVITE_LINK => ExportChatInviteLink::execute($bot, $parameters),
|
||||||
|
self::CREATE_CHAT_INVITE_LINK => CreateChatInviteLink::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
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
Reference in a new issue