Skip to content

Commit

Permalink
feat: added an error for caps in command_option
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 committed Oct 4, 2023
1 parent 0dee598 commit 067126b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dpp/slashcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 067126b

Please sign in to comment.