Add GetChatMemberCount method to TgBotLib
This commit is contained in:
parent
7a18d72419
commit
576deca185
2 changed files with 40 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
|||
use TgBotLib\Methods\ForwardMessages;
|
||||
use TgBotLib\Methods\GetChat;
|
||||
use TgBotLib\Methods\GetChatAdministrators;
|
||||
use TgBotLib\Methods\GetChatMemberCount;
|
||||
use TgBotLib\Methods\GetFile;
|
||||
use TgBotLib\Methods\GetMe;
|
||||
use TgBotLib\Methods\GetUpdates;
|
||||
|
@ -120,6 +121,7 @@
|
|||
case LEAVE_CHAT = 'leaveChat';
|
||||
case GET_CHAT = 'getChat';
|
||||
case GET_CHAT_ADMINISTRATORS = 'getChatAdministrators';
|
||||
case GET_CHAT_MEMBER_COUNT = 'getChatMemberCount';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -189,6 +191,7 @@
|
|||
self::LEAVE_CHAT => LeaveChat::execute($bot, $parameters),
|
||||
self::GET_CHAT => GetChat::execute($bot, $parameters),
|
||||
self::GET_CHAT_ADMINISTRATORS => GetChatAdministrators::execute($bot, $parameters),
|
||||
self::GET_CHAT_MEMBER_COUNT => GetChatMemberCount::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
37
src/TgBotLib/Methods/GetChatMemberCount.php
Normal file
37
src/TgBotLib/Methods/GetChatMemberCount.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
|
||||
class GetChatMemberCount extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): int
|
||||
{
|
||||
return self::executeCurl(self::buildPost($bot, Methods::GET_CHAT_MEMBER_COUNT->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