diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 4c538e4..0a72ea3 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -38,6 +38,7 @@ use TgBotLib\Methods\GetFile; use TgBotLib\Methods\GetForumTopicIconStickers; use TgBotLib\Methods\GetMe; + use TgBotLib\Methods\GetMyCommands; use TgBotLib\Methods\GetUpdates; use TgBotLib\Methods\GetUserChatBoosts; use TgBotLib\Methods\GetUserProfilePhotos; @@ -164,6 +165,7 @@ case GET_BUSINESS_CONNECTION = 'getBusinessConnection'; case SET_MY_COMMANDS = 'setMyCommands'; case DELETE_MY_COMMANDS = 'deleteMyCommands'; + case GET_MY_COMMANDS = 'getMyCommands'; /** * Executes a command on the provided bot with the given parameters. @@ -255,6 +257,7 @@ self::GET_BUSINESS_CONNECTION => GetBusinessConnection::execute($bot, $parameters), self::SET_MY_COMMANDS => SetMyCommands::execute($bot, $parameters), self::DELETE_MY_COMMANDS => DeleteMyCommands::execute($bot, $parameters), + self::GET_MY_COMMANDS => GetMyCommands::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/GetMyCommands.php b/src/TgBotLib/Methods/GetMyCommands.php new file mode 100644 index 0000000..24b28f7 --- /dev/null +++ b/src/TgBotLib/Methods/GetMyCommands.php @@ -0,0 +1,49 @@ +toArray()); + } + + return array_map( + fn($update) => BotCommand::fromArray($update), + self::executeCurl(self::buildPost($bot, Methods::GET_MY_COMMANDS->value, $parameters)) + ); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return null; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return [ + 'scope', + 'language_code' + ]; + } + } \ No newline at end of file