Add EditChatInviteLink method to the library
This commit is contained in:
parent
6315f5840d
commit
24fe2f2b91
2 changed files with 46 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
|||
use TgBotLib\Methods\CopyMessages;
|
||||
use TgBotLib\Methods\CreateChatInviteLink;
|
||||
use TgBotLib\Methods\DeleteWebhook;
|
||||
use TgBotLib\Methods\EditChatInviteLink;
|
||||
use TgBotLib\Methods\ExportChatInviteLink;
|
||||
use TgBotLib\Methods\ForwardMessage;
|
||||
use TgBotLib\Methods\ForwardMessages;
|
||||
|
@ -88,6 +89,7 @@
|
|||
case SET_CHAT_PERMISSIONS = 'setChatPermissions';
|
||||
case EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink';
|
||||
case CREATE_CHAT_INVITE_LINK = 'createChatInviteLink';
|
||||
case EDIT_CHAT_INVITE_LINK = 'editChatInviteLink';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -141,6 +143,7 @@
|
|||
self::SET_CHAT_PERMISSIONS => SetChatPermissions::execute($bot, $parameters),
|
||||
self::EXPORT_CHAT_INVITE_LINK => ExportChatInviteLink::execute($bot, $parameters),
|
||||
self::CREATE_CHAT_INVITE_LINK => CreateChatInviteLink::execute($bot, $parameters),
|
||||
self::EDIT_CHAT_INVITE_LINK => EditChatInviteLink::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
43
src/TgBotLib/Methods/EditChatInviteLink.php
Normal file
43
src/TgBotLib/Methods/EditChatInviteLink.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
use TgBotLib\Objects\ChatInviteLink;
|
||||
|
||||
class EditChatInviteLink extends Method
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): ChatInviteLink
|
||||
{
|
||||
return ChatInviteLink::fromArray($bot->sendRequest(Methods::EDIT_CHAT_INVITE_LINK->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id',
|
||||
'invite_link'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'name',
|
||||
'expire_date',
|
||||
'member_limit',
|
||||
'creates_join_request'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue