diff --git a/include/dpp/appcommand.h b/include/dpp/appcommand.h index 68ae42c283..b5979241fc 100644 --- a/include/dpp/appcommand.h +++ b/include/dpp/appcommand.h @@ -1444,6 +1444,11 @@ class DPP_EXPORT slashcommand : public managed, public json_interface integration_types; + /** * @brief Interaction context(s) where the command can be used, only for globally-scoped commands. By default, all interaction context types included for new commands. */ diff --git a/include/dpp/application.h b/include/dpp/application.h index eb7e8b32df..0e0f67fc00 100644 --- a/include/dpp/application.h +++ b/include/dpp/application.h @@ -21,6 +21,7 @@ ************************************************************************************/ #pragma once +#include #include #include #include @@ -30,6 +31,7 @@ #include #include #include +#include namespace dpp { @@ -209,6 +211,13 @@ class DPP_EXPORT app_team { snowflake owner_user_id; }; +/** + * * @brief Configuration object for an app installation + * */ +struct integration_configuration { + std::optional oauth2_install_params; +}; + /** * @brief The application class represents details of a bot application */ @@ -352,6 +361,11 @@ class DPP_EXPORT application : public managed, public json_interface integration_types_config; + /** * @brief The application's default custom authorization link, if enabled. */ diff --git a/include/dpp/integration.h b/include/dpp/integration.h index 1e48c7be65..acde8addb3 100644 --- a/include/dpp/integration.h +++ b/include/dpp/integration.h @@ -30,6 +30,20 @@ namespace dpp { +/** + * @brief Where an app can be installed, also called its supported installation contexts. + */ +enum application_integration_types { + /** + * @brief Installable to servers + */ + ait_guild_install = 0, + /** + * @brief Installable to users + */ + ait_user_install = 1, +}; + /** * @brief Integration types */ diff --git a/src/dpp/application.cpp b/src/dpp/application.cpp index 78908a03fe..6ba501788b 100644 --- a/src/dpp/application.cpp +++ b/src/dpp/application.cpp @@ -21,6 +21,7 @@ ************************************************************************************/ #include #include +#include #include #include #include @@ -118,6 +119,10 @@ application& application::fill_from_json_impl(nlohmann::json* j) { } } + if (auto it = j->find("integration_types_config"); it != j->end()) { + it->get_to(this->integration_types_config); + } + set_string_not_null(j, "custom_install_url", custom_install_url); // TODO: Investigate https://discord.com/developers/docs/resources/application#application-resource when v11 releases. See if the variables below are documented. diff --git a/src/dpp/slashcommand.cpp b/src/dpp/slashcommand.cpp index 616691c2d6..865ebe653c 100644 --- a/src/dpp/slashcommand.cpp +++ b/src/dpp/slashcommand.cpp @@ -75,6 +75,11 @@ slashcommand& slashcommand::fill_from_json_impl(nlohmann::json* j) { type = (slashcommand_contextmenu_type)int8_not_null(j, "type"); set_object_array_not_null(j, "options", options); // command_option fills recursive + + if (auto it = j->find("integration_types"); it != j->end()) { + it->get_to(this->integration_types); + } + if (auto it = j->find("contexts"); it != j->end()) { std::copy(it->begin(), it->end(), std::back_inserter(contexts)); } @@ -256,6 +261,10 @@ void to_json(json& j, const slashcommand& p) { } } + if (p.integration_types.size()) { + j["integration_types"] = p.integration_types; + } + // TODO: Maybe a std::optional is better to differentiate if (p.contexts.size()) { j["contexts"] = p.contexts;