Add ExportChatInviteLink method to TgBotLib

This commit is contained in:
netkas 2024-11-06 00:24:46 -05:00
parent 307521debc
commit 2f2fefbe9d
2 changed files with 40 additions and 0 deletions

View file

@ -11,6 +11,7 @@
use TgBotLib\Methods\CopyMessage;
use TgBotLib\Methods\CopyMessages;
use TgBotLib\Methods\DeleteWebhook;
use TgBotLib\Methods\ExportChatInviteLink;
use TgBotLib\Methods\ForwardMessage;
use TgBotLib\Methods\ForwardMessages;
use TgBotLib\Methods\GetFile;
@ -84,6 +85,7 @@
case BAN_CHAT_SENDER_CHAT = 'banChatSenderChat';
case UNBAN_CHAT_SENDER_CHAT = 'unbanChatSenderChat';
case SET_CHAT_PERMISSIONS = 'setChatPermissions';
case EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink';
/**
* Executes a command on the provided bot with the given parameters.
@ -135,6 +137,7 @@
self::BAN_CHAT_SENDER_CHAT => BanChatSenderChat::execute($bot, $parameters),
self::UNBAN_CHAT_SENDER_CHAT => UnbanChatSenderChat::execute($bot, $parameters),
self::SET_CHAT_PERMISSIONS => SetChatPermissions::execute($bot, $parameters),
self::EXPORT_CHAT_INVITE_LINK => ExportChatInviteLink::execute($bot, $parameters),
};
}
}

View file

@ -0,0 +1,37 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
class ExportChatInviteLink extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): string
{
return $bot->sendRequest(Methods::EXPORT_CHAT_INVITE_LINK->value, $parameters);
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}