Add LeaveChat method to bot API
This commit is contained in:
parent
7ee714b36c
commit
1661e744ab
2 changed files with 40 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
|||
use TgBotLib\Methods\GetUpdates;
|
||||
use TgBotLib\Methods\GetUserProfilePhotos;
|
||||
use TgBotLib\Methods\GetWebhookInfo;
|
||||
use TgBotLib\Methods\LeaveChat;
|
||||
use TgBotLib\Methods\Logout;
|
||||
use TgBotLib\Methods\PinChatMessage;
|
||||
use TgBotLib\Methods\PromoteChatMember;
|
||||
|
@ -114,6 +115,7 @@
|
|||
case PIN_CHAT_MESSAGE = 'pinChatMessage';
|
||||
case UNPIN_CHAT_MESSAGE = 'unpinChatMessage';
|
||||
case UNPIN_ALL_CHAT_MESSAGES = 'unpinAllChatMessages';
|
||||
case LEAVE_CHAT = 'leaveChat';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -180,6 +182,7 @@
|
|||
self::PIN_CHAT_MESSAGE => PinChatMessage::execute($bot, $parameters),
|
||||
self::UNPIN_CHAT_MESSAGE => UnpinChatMessage::execute($bot, $parameters),
|
||||
self::UNPIN_ALL_CHAT_MESSAGES => UnpinAllChatMessages::execute($bot, $parameters),
|
||||
self::LEAVE_CHAT => LeaveChat::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
37
src/TgBotLib/Methods/LeaveChat.php
Normal file
37
src/TgBotLib/Methods/LeaveChat.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
|
||||
class LeaveChat extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
return (bool)self::executeCurl(self::buildPost($bot, Methods::LEAVE_CHAT->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue