diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index bf44d1f..17f9a80 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -22,6 +22,7 @@ use TgBotLib\Methods\ForwardMessage; use TgBotLib\Methods\ForwardMessages; use TgBotLib\Methods\GetChat; + use TgBotLib\Methods\GetChatAdministrators; use TgBotLib\Methods\GetFile; use TgBotLib\Methods\GetMe; use TgBotLib\Methods\GetUpdates; @@ -118,6 +119,7 @@ case UNPIN_ALL_CHAT_MESSAGES = 'unpinAllChatMessages'; case LEAVE_CHAT = 'leaveChat'; case GET_CHAT = 'getChat'; + case GET_CHAT_ADMINISTRATORS = 'getChatAdministrators'; /** * Executes a command on the provided bot with the given parameters. @@ -185,7 +187,8 @@ self::UNPIN_CHAT_MESSAGE => UnpinChatMessage::execute($bot, $parameters), self::UNPIN_ALL_CHAT_MESSAGES => UnpinAllChatMessages::execute($bot, $parameters), self::LEAVE_CHAT => LeaveChat::execute($bot, $parameters), - self::GET_CHAT => GetChat::execute($bot, $parameters) + self::GET_CHAT => GetChat::execute($bot, $parameters), + self::GET_CHAT_ADMINISTRATORS => GetChatAdministrators::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/GetChatAdministrators.php b/src/TgBotLib/Methods/GetChatAdministrators.php new file mode 100644 index 0000000..dc3d634 --- /dev/null +++ b/src/TgBotLib/Methods/GetChatAdministrators.php @@ -0,0 +1,42 @@ + ChatMember::fromArray($update), + self::executeCurl(self::buildPost($bot, Methods::GET_CHAT_ADMINISTRATORS->value, $parameters)) + ); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'chat_id' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return null; + } + } \ No newline at end of file