Add EditChatSubscriptionInviteLink method

This commit is contained in:
netkas 2024-11-06 15:15:15 -05:00
parent 59af689364
commit b116ec4447
2 changed files with 46 additions and 0 deletions

View file

@ -14,6 +14,7 @@
use TgBotLib\Methods\CreateChatSubscriptionInviteLink;
use TgBotLib\Methods\DeleteWebhook;
use TgBotLib\Methods\EditChatInviteLink;
use TgBotLib\Methods\EditChatSubscriptionInviteLink;
use TgBotLib\Methods\ExportChatInviteLink;
use TgBotLib\Methods\ForwardMessage;
use TgBotLib\Methods\ForwardMessages;
@ -92,6 +93,7 @@
case CREATE_CHAT_INVITE_LINK = 'createChatInviteLink';
case EDIT_CHAT_INVITE_LINK = 'editChatInviteLink';
case CREATE_CHAT_SUBSCRIPTION_INVITE_LINK = 'createChatSubscriptionInviteLink';
case EDIT_CHAT_SUBSCRIPTION_INVITE_LINK = 'editChatSubscriptionInviteLink';
/**
* Executes a command on the provided bot with the given parameters.
@ -147,6 +149,7 @@
self::CREATE_CHAT_INVITE_LINK => CreateChatInviteLink::execute($bot, $parameters),
self::EDIT_CHAT_INVITE_LINK => EditChatInviteLink::execute($bot, $parameters),
self::CREATE_CHAT_SUBSCRIPTION_INVITE_LINK => CreateChatSubscriptionInviteLink::execute($bot, $parameters),
self::EDIT_CHAT_SUBSCRIPTION_INVITE_LINK => EditChatSubscriptionInviteLink::execute($bot, $parameters),
};
}
}

View 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 EditChatSubscriptionInviteLink extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): ChatInviteLink
{
return ChatInviteLink::fromArray(
self::executeCurl(self::buildPost($bot, Methods::EDIT_CHAT_SUBSCRIPTION_INVITE_LINK->value, $parameters))
);
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'invite_link'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'name'
];
}
}