Add BanChatSenderChat method to TgBotLib
This commit is contained in:
parent
c535977bac
commit
3757b9106a
2 changed files with 41 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
use TgBotLib\Exceptions\TelegramException;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Methods\BanChatMember;
|
||||
use TgBotLib\Methods\BanChatSenderChat;
|
||||
use TgBotLib\Methods\Close;
|
||||
use TgBotLib\Methods\CopyMessage;
|
||||
use TgBotLib\Methods\CopyMessages;
|
||||
|
@ -78,6 +79,7 @@
|
|||
case RESTRICT_CHAT_MEMBER = 'restrictChatMember';
|
||||
case PROMOTE_CHAT_MEMBER = 'promoteChatMember';
|
||||
case SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE = 'setChatAdministratorCustomTitle';
|
||||
case BAN_CHAT_SENDER_CHAT = 'banChatSenderChat';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -126,6 +128,7 @@
|
|||
self::RESTRICT_CHAT_MEMBER => RestrictChatMember::execute($bot, $parameters),
|
||||
self::PROMOTE_CHAT_MEMBER => PromoteChatMember::execute($bot, $parameters),
|
||||
self::SET_CHAT_ADMINISTRATOR_CUSTOM_TITLE => SetChatAdministratorCustomTitle::execute($bot, $parameters),
|
||||
self::BAN_CHAT_SENDER_CHAT => BanChatSenderChat::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
38
src/TgBotLib/Methods/BanChatSenderChat.php
Normal file
38
src/TgBotLib/Methods/BanChatSenderChat.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
|
||||
class BanChatSenderChat extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
return (bool)$bot->sendRequest(Methods::BAN_CHAT_SENDER_CHAT->value, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id',
|
||||
'sender_chat_id'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue