Add RevokeChatInviteLink method
This commit is contained in:
parent
b116ec4447
commit
5b05fe155b
2 changed files with 44 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
||||||
use TgBotLib\Methods\Logout;
|
use TgBotLib\Methods\Logout;
|
||||||
use TgBotLib\Methods\PromoteChatMember;
|
use TgBotLib\Methods\PromoteChatMember;
|
||||||
use TgBotLib\Methods\RestrictChatMember;
|
use TgBotLib\Methods\RestrictChatMember;
|
||||||
|
use TgBotLib\Methods\RevokeChatInviteLink;
|
||||||
use TgBotLib\Methods\SendAnimation;
|
use TgBotLib\Methods\SendAnimation;
|
||||||
use TgBotLib\Methods\SendAudio;
|
use TgBotLib\Methods\SendAudio;
|
||||||
use TgBotLib\Methods\SendChatAction;
|
use TgBotLib\Methods\SendChatAction;
|
||||||
|
@ -94,6 +95,7 @@
|
||||||
case EDIT_CHAT_INVITE_LINK = 'editChatInviteLink';
|
case EDIT_CHAT_INVITE_LINK = 'editChatInviteLink';
|
||||||
case CREATE_CHAT_SUBSCRIPTION_INVITE_LINK = 'createChatSubscriptionInviteLink';
|
case CREATE_CHAT_SUBSCRIPTION_INVITE_LINK = 'createChatSubscriptionInviteLink';
|
||||||
case EDIT_CHAT_SUBSCRIPTION_INVITE_LINK = 'editChatSubscriptionInviteLink';
|
case EDIT_CHAT_SUBSCRIPTION_INVITE_LINK = 'editChatSubscriptionInviteLink';
|
||||||
|
case REVOKE_CHAT_INVITE_LINK = 'revokeChatInviteLink';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -150,6 +152,7 @@
|
||||||
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),
|
self::CREATE_CHAT_SUBSCRIPTION_INVITE_LINK => CreateChatSubscriptionInviteLink::execute($bot, $parameters),
|
||||||
self::EDIT_CHAT_SUBSCRIPTION_INVITE_LINK => EditChatSubscriptionInviteLink::execute($bot, $parameters),
|
self::EDIT_CHAT_SUBSCRIPTION_INVITE_LINK => EditChatSubscriptionInviteLink::execute($bot, $parameters),
|
||||||
|
self::REVOKE_CHAT_INVITE_LINK => RevokeChatInviteLink::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
41
src/TgBotLib/Methods/RevokeChatInviteLink.php
Normal file
41
src/TgBotLib/Methods/RevokeChatInviteLink.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
use TgBotLib\Objects\ChatInviteLink;
|
||||||
|
|
||||||
|
class RevokeChatInviteLink extends Method
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): ChatInviteLink
|
||||||
|
{
|
||||||
|
return ChatInviteLink::fromArray(
|
||||||
|
self::executeCurl(self::buildPost($bot, Methods::REVOKE_CHAT_INVITE_LINK->value, $parameters))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'chat_id',
|
||||||
|
'invite_link'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue