Add GetChatMember method functionality
This commit is contained in:
parent
576deca185
commit
4893a23bfa
2 changed files with 42 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
|||
use TgBotLib\Methods\ForwardMessages;
|
||||
use TgBotLib\Methods\GetChat;
|
||||
use TgBotLib\Methods\GetChatAdministrators;
|
||||
use TgBotLib\Methods\GetChatMember;
|
||||
use TgBotLib\Methods\GetChatMemberCount;
|
||||
use TgBotLib\Methods\GetFile;
|
||||
use TgBotLib\Methods\GetMe;
|
||||
|
@ -122,6 +123,7 @@
|
|||
case GET_CHAT = 'getChat';
|
||||
case GET_CHAT_ADMINISTRATORS = 'getChatAdministrators';
|
||||
case GET_CHAT_MEMBER_COUNT = 'getChatMemberCount';
|
||||
case GET_CHAT_MEMBER = 'getChatMember';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -192,6 +194,7 @@
|
|||
self::GET_CHAT => GetChat::execute($bot, $parameters),
|
||||
self::GET_CHAT_ADMINISTRATORS => GetChatAdministrators::execute($bot, $parameters),
|
||||
self::GET_CHAT_MEMBER_COUNT => GetChatMemberCount::execute($bot, $parameters),
|
||||
self::GET_CHAT_MEMBER => GetChatMember::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
39
src/TgBotLib/Methods/GetChatMember.php
Normal file
39
src/TgBotLib/Methods/GetChatMember.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
use TgBotLib\Objects\ChatMember;
|
||||
|
||||
class GetChatMember extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): ChatMember
|
||||
{
|
||||
return ChatMember::fromArray(self::executeCurl(self::buildPost($bot, Methods::GET_CHAT_MEMBER->value, $parameters)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id',
|
||||
'user_id'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue