Add CreateChatSubscriptionInviteLink method
This commit is contained in:
parent
646c77c4ba
commit
9817608eb7
2 changed files with 47 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
||||||
use TgBotLib\Methods\CopyMessage;
|
use TgBotLib\Methods\CopyMessage;
|
||||||
use TgBotLib\Methods\CopyMessages;
|
use TgBotLib\Methods\CopyMessages;
|
||||||
use TgBotLib\Methods\CreateChatInviteLink;
|
use TgBotLib\Methods\CreateChatInviteLink;
|
||||||
|
use TgBotLib\Methods\CreateChatSubscriptionInviteLink;
|
||||||
use TgBotLib\Methods\DeleteWebhook;
|
use TgBotLib\Methods\DeleteWebhook;
|
||||||
use TgBotLib\Methods\EditChatInviteLink;
|
use TgBotLib\Methods\EditChatInviteLink;
|
||||||
use TgBotLib\Methods\ExportChatInviteLink;
|
use TgBotLib\Methods\ExportChatInviteLink;
|
||||||
|
@ -90,6 +91,7 @@
|
||||||
case EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink';
|
case EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink';
|
||||||
case CREATE_CHAT_INVITE_LINK = 'createChatInviteLink';
|
case CREATE_CHAT_INVITE_LINK = 'createChatInviteLink';
|
||||||
case EDIT_CHAT_INVITE_LINK = 'editChatInviteLink';
|
case EDIT_CHAT_INVITE_LINK = 'editChatInviteLink';
|
||||||
|
case CREATE_CHAT_SUBSCRIPTION_INVITE_LINK = 'createChatSubscriptionInviteLink';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -144,6 +146,7 @@
|
||||||
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),
|
self::CREATE_CHAT_INVITE_LINK => CreateChatInviteLink::execute($bot, $parameters),
|
||||||
self::EDIT_CHAT_INVITE_LINK => EditChatInviteLink::execute($bot, $parameters),
|
self::EDIT_CHAT_INVITE_LINK => EditChatInviteLink::execute($bot, $parameters),
|
||||||
|
self::CREATE_CHAT_SUBSCRIPTION_INVITE_LINK => CreateChatSubscriptionInviteLink::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
44
src/TgBotLib/Methods/CreateChatSubscriptionInviteLink.php
Normal file
44
src/TgBotLib/Methods/CreateChatSubscriptionInviteLink.php
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
use TgBotLib\Objects\ChatInviteLink;
|
||||||
|
|
||||||
|
class CreateChatSubscriptionInviteLink extends Method
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): ChatInviteLink
|
||||||
|
{
|
||||||
|
return ChatInviteLink::fromArray(
|
||||||
|
self::executeCurl(self::buildPost($bot, Methods::CREATE_CHAT_SUBSCRIPTION_INVITE_LINK->value, $parameters))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'chat_id',
|
||||||
|
'subscription_period',
|
||||||
|
'subscription_price'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue