Represents a modal dialog box response to an interaction. More...
#include "appcommand.h"
Public Member Functions | |
interaction_modal_response () | |
Construct a new interaction modal response object. More... | |
interaction_modal_response (const std::string &_custom_id, const std::string &_title, const std::vector< component > _components={}) | |
Construct a new interaction modal response object. More... | |
virtual | ~interaction_modal_response ()=default |
Destroy the interaction modal response object. More... | |
interaction_response & | add_autocomplete_choice (const command_option_choice &achoice) |
Add a command option choice. More... | |
interaction_modal_response & | add_component (const component &c) |
Add a component to an interaction modal response. More... | |
interaction_modal_response & | add_row () |
Add a new row to the interaction modal response. More... | |
template<typename U = T, typename = decltype(std::declval<U&>().to_json_impl(bool{}))> | |
std::string | build_json (bool with_id=false) const |
Convert object to json string. More... | |
std::string | build_json (bool with_id=false) const |
Convert object to json string. More... | |
interaction_response & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
template<typename U = T, typename = decltype(std::declval<U&>().fill_from_json_impl(std::declval<nlohmann::json*>()))> | |
T & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
interaction_modal_response & | set_custom_id (const std::string &_custom_id) |
Set the custom id. More... | |
interaction_modal_response & | set_title (const std::string &_title) |
Set the title. More... | |
auto | to_json (bool with_id=false) const |
Convert object to nlohmann::json. More... | |
template<typename U = T, typename = decltype(std::declval<U&>().to_json_impl(bool{}))> | |
auto | to_json (bool with_id=false) const |
Convert object to nlohmann::json. More... | |
Public Attributes | |
std::vector< command_option_choice > | autocomplete_choices {} |
Array of up to 25 autocomplete choices. More... | |
std::vector< std::vector< component > > | components |
List of components. More... | |
std::string | custom_id |
Custom ID for the modal form. More... | |
message | msg {} |
Message tied to this response. More... | |
std::string | title |
Title of the modal form box (max 25 characters) More... | |
interaction_response_type | type {} |
Response type from dpp::interaction_response_type. More... | |
Protected Member Functions | |
virtual interaction_modal_response & | fill_from_json_impl (nlohmann::json *j) |
Fill object properties from JSON. More... | |
virtual json | to_json_impl (bool with_id=false) const |
Build a json for this object. More... | |
Protected Attributes | |
size_t | current_row |
Friends | |
struct | json_interface< interaction_modal_response > |
Represents a modal dialog box response to an interaction.
A dialog box is a modal popup which appears to the user instead of a message. One or more components are displayed on a form (the same component structure as within a dpp::message). When the user submits the form an on_form_submit event is dispatched to any listeners.
dpp::interaction_modal_response::interaction_modal_response | ( | ) |
Construct a new interaction modal response object.
dpp::interaction_modal_response::interaction_modal_response | ( | const std::string & | _custom_id, |
const std::string & | _title, | ||
const std::vector< component > | _components = {} |
||
) |
Construct a new interaction modal response object.
_custom_id | Custom ID of the modal form |
_title | Title of the modal form. It will be truncated to the maximum length of 45 UTF-8 characters. |
_components | Components to add to the modal form |
|
virtualdefault |
Destroy the interaction modal response object.
|
inherited |
Add a command option choice.
achoice | command option choice to add |
interaction_modal_response & dpp::interaction_modal_response::add_component | ( | const component & | c | ) |
Add a component to an interaction modal response.
c | component to add |
References title.
interaction_modal_response & dpp::interaction_modal_response::add_row | ( | ) |
Add a new row to the interaction modal response.
dpp::logic_exception | if more than five rows are attempted to be added |
|
inlineinherited |
Convert object to json string.
with_id | Whether to include the ID or not |
|
inlineinherited |
Convert object to json string.
with_id | Whether to include the ID or not |
Referenced by dpp::cluster::create_webhook(), dpp::cluster::guild_ban_add(), dpp::cluster::guild_ban_delete(), dpp::cluster::guild_command_edit_permissions(), dpp::cluster::guild_create(), dpp::cluster::guild_get_integrations(), dpp::cluster::guild_get_preview(), dpp::cluster::guild_get_vanity(), and dpp::cluster::roles_get().
|
inlineinherited |
Convert object from nlohmann::json.
j | nlohmann::json object |
Referenced by dpp::invite::fill_from_json_impl(), dpp::thread::fill_from_json_impl(), dpp::scheduled_event::fill_from_json_impl(), dpp::from_json(), dpp::message::get_url(), and dpp::interaction_response::interaction_response().
|
inlineinherited |
Convert object from nlohmann::json.
j | nlohmann::json object |
|
protectedvirtual |
Fill object properties from JSON.
j | JSON to fill from |
Reimplemented from dpp::interaction_response.
interaction_modal_response & dpp::interaction_modal_response::set_custom_id | ( | const std::string & | _custom_id | ) |
Set the custom id.
_custom_id | custom id to set |
interaction_modal_response & dpp::interaction_modal_response::set_title | ( | const std::string & | _title | ) |
Set the title.
_title | title to set |
References dpp::guild_command_permissions::application_id, dpp::guild_command_permissions::guild_id, and dpp::snowflake_not_null().
|
inlineinherited |
Convert object to nlohmann::json.
with_id | Whether to include the ID or not |
|
inlineinherited |
Convert object to nlohmann::json.
with_id | Whether to include the ID or not |
Referenced by dpp::cluster::delete_webhook_with_token(), and dpp::onboarding_prompt::onboarding_prompt().
|
protectedvirtual |
Build a json for this object.
with_id | include id in json output |
Reimplemented from dpp::interaction_response.
References components, and current_row.
|
friend |
|
inherited |
Array of up to 25 autocomplete choices.
std::vector<std::vector<component> > dpp::interaction_modal_response::components |
List of components.
All components must be placed within an action row, each outer vector is the action row.
Referenced by to_json_impl().
|
protected |
Referenced by to_json_impl().
std::string dpp::interaction_modal_response::custom_id |
Custom ID for the modal form.
|
inherited |
Message tied to this response.
std::string dpp::interaction_modal_response::title |
Title of the modal form box (max 25 characters)
Referenced by add_component().
|
inherited |
Response type from dpp::interaction_response_type.
Should be one of ir_pong, ir_channel_message_with_source, or ir_deferred_channel_message_with_source.