Add BanChatSenderChat method to TgBotLib

This commit is contained in:
netkas 2024-11-06 00:18:45 -05:00
parent c535977bac
commit 3757b9106a
2 changed files with 41 additions and 0 deletions

View file

@ -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),
};
}
}

View 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;
}
}