Add BanChatMember method to TgBotLib
This commit is contained in:
parent
d9dd03f601
commit
9e2e19d593
2 changed files with 44 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
use TgBotLib\Bot;
|
||||
use TgBotLib\Exceptions\TelegramException;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Methods\BanChatMember;
|
||||
use TgBotLib\Methods\Close;
|
||||
use TgBotLib\Methods\CopyMessage;
|
||||
use TgBotLib\Methods\CopyMessages;
|
||||
|
@ -68,6 +69,7 @@
|
|||
case SET_MESSAGE_REACTION = 'setMessageReaction';
|
||||
case GET_USER_PROFILE_PHOTOS = 'getUserProfilePhotos';
|
||||
case GET_FILE = 'getFile';
|
||||
case BAN_CHAT_MEMBER = 'banChatMember';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -111,6 +113,7 @@
|
|||
self::SET_MESSAGE_REACTION => SetMessageReaction::execute($bot, $parameters),
|
||||
self::GET_USER_PROFILE_PHOTOS => GetUserProfilePhotos::execute($bot, $parameters),
|
||||
self::GET_FILE => GetFile::execute($bot, $parameters),
|
||||
self::BAN_CHAT_MEMBER => BanChatMember::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
41
src/TgBotLib/Methods/BanChatMember.php
Normal file
41
src/TgBotLib/Methods/BanChatMember.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
|
||||
class BanChatMember extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
return (bool)$bot->sendRequest(Methods::BAN_CHAT_MEMBER->value, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id',
|
||||
'user_id'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'until_date',
|
||||
'revoke_messages'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue