From 067126be7ae6d452b15a5e570e615497b001936a Mon Sep 17 00:00:00 2001 From: Jaskowicz1 Date: Wed, 4 Oct 2023 09:32:32 +0100 Subject: [PATCH] feat: added an error for caps in command_option --- src/dpp/slashcommand.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dpp/slashcommand.cpp b/src/dpp/slashcommand.cpp index 336e43e831..9832eb28f4 100644 --- a/src/dpp/slashcommand.cpp +++ b/src/dpp/slashcommand.cpp @@ -333,6 +333,9 @@ command_option_choice &command_option_choice::fill_from_json(nlohmann::json *j) command_option::command_option(command_option_type t, const std::string &n, const std::string &d, bool r) : type(t), name(n), description(d), required(r), autocomplete(false) { + if (std::any_of(n.begin(), n.end(), [](unsigned char c){ return std::isupper(c); })) { + throw dpp::logic_exception("Command options can not contain capital letters in the name of the option."); + } } command_option& command_option::add_choice(const command_option_choice &o)