Skip to content

Commit

Permalink
Merge pull request #463 from Neko-Life/dev
Browse files Browse the repository at this point in the history
Add autocomplete support for subcommands arguments
  • Loading branch information
braindigitalis committed Aug 14, 2022
2 parents e9990cf + d817fe5 commit f540efa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/dpp/appcommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ struct DPP_EXPORT component_interaction {
/**
* @brief An auto complete interaction
*/
struct DPP_EXPORT autocomplete_interaction {
struct DPP_EXPORT autocomplete_interaction : public command_interaction {
};

/**
Expand Down
7 changes: 7 additions & 0 deletions src/dpp/slashcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,14 @@ void from_json(const nlohmann::json& j, component_interaction& bi) {
}

void from_json(const nlohmann::json& j, autocomplete_interaction& ai) {
ai.id = snowflake_not_null(&j, "id");
ai.name = string_not_null(&j, "name");
ai.type = (dpp::slashcommand_contextmenu_type)int8_not_null(&j, "type");
ai.target_id = snowflake_not_null(&j, "target_id");

if (j.contains("options") && !j.at("options").is_null()) {
j.at("options").get_to(ai.options);
}
}

void from_json(const nlohmann::json& j, interaction& i) {
Expand Down

0 comments on commit f540efa

Please sign in to comment.