| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
dpp::interaction_modal_response Struct Reference

Represents a modal dialog box response to an interaction. More...

`#include <appcommand.h>`

Inheritance diagram for dpp::interaction_modal_response:
[legend]
Collaboration diagram for dpp::interaction_modal_response:
[legend]

## Public Member Functions

| interaction_modal_response ()
| Construct a new interaction modal response object.
| interaction_modal_response (const interaction_modal_response &other)=default
| Copy constructor.
| interaction_modal_response (const std::string &_custom_id, const std::string &_title, const std::vector< component > _components={})
| Construct a new interaction modal response object.
| interaction_modal_response (interaction_modal_response &&other) noexcept=default
| Move constructor.
virtual | ~interaction_modal_response ()=default
| Destroy the interaction modal response object.
interaction_response & | add_autocomplete_choice (const command_option_choice &achoice)
| Add a command option choice.
interaction_modal_response & | add_component (const component &c)
| Add a component to an interaction modal response.
interaction_modal_response & | add_row ()
| Add a new row to the interaction modal response.
std::string | build_json (bool with_id=false) const
| Convert object to json string.
std::string | build_json (bool with_id=false) const
| Convert object to json string.
interaction_modal_response & | fill_from_json (nlohmann::json *j)
| Convert object from nlohmann::json.
interaction_response & | fill_from_json (nlohmann::json *j)
| Convert object from nlohmann::json.
interaction_modal_response & | operator= (const interaction_modal_response &other)=default
| Copy assignment operator.
interaction_modal_response & | operator= (interaction_modal_response &&other) noexcept=default
| Move assignment operator.
interaction_modal_response & | set_custom_id (const std::string &_custom_id)
| Set the custom id.
interaction_modal_response & | set_title (const std::string &_title)
| Set the title.
auto | to_json (bool with_id=false) const
| Convert object to nlohmann::json.
auto | to_json (bool with_id=false) const
| Convert object to nlohmann::json.

## Public Attributes

std::vector< command_option_choice > | autocomplete_choices {}
| Array of up to 25 autocomplete choices.
std::vector< std::vector< component > > | components
| List of components. All components must be placed within an action row, each outer vector is the action row.
std::string | custom_id
| Custom ID for the modal form.
message | msg {}
| Message tied to this response.
std::string | title
| Title of the modal form box (max 25 characters).
interaction_response_type | type {}
| 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.

## Protected Member Functions

virtual interaction_modal_response & | fill_from_json_impl (nlohmann::json *j)
| Fill object properties from JSON.
virtual json | to_json_impl (bool with_id=false) const
| Build a json for this object.

## Protected Attributes

size_t | current_row

## Friends

struct | json_interface< interaction_modal_response >

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ interaction_modal_response() [1/4]

dpp::interaction_modal_response::interaction_modal_response | ( |  | ) |

Construct a new interaction modal response object.

## ◆ interaction_modal_response() [2/4]

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.

Parameters

  _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

## ◆ interaction_modal_response() [3/4]

dpp::interaction_modal_response::interaction_modal_response | ( | const interaction_modal_response & | other | ) |

default

Copy constructor.

Parameters

  other | The object to copy from

## ◆ interaction_modal_response() [4/4]

dpp::interaction_modal_response::interaction_modal_response | ( | interaction_modal_response && | other | ) |

default noexcept

Move constructor.

Parameters

  other | The object to move from

## ◆ ~interaction_modal_response()

virtual dpp::interaction_modal_response::~interaction_modal_response | ( |  | ) |

virtual default

Destroy the interaction modal response object.

## Member Function Documentation

## ◆ add_autocomplete_choice()

interaction_response & dpp::interaction_response::add_autocomplete_choice | ( | const command_option_choice & | achoice | ) |

inherited

Add a command option choice.

Parameters

  achoice | command option choice to add

Returns
  interaction_response& Reference to self

## ◆ add_component()

interaction_modal_response & dpp::interaction_modal_response::add_component | ( | const component & | c | ) |

Add a component to an interaction modal response.

Parameters

  c | component to add

Returns
  interaction_modal_response& Reference to self

## ◆ add_row()

interaction_modal_response & dpp::interaction_modal_response::add_row | ( |  | ) |

Add a new row to the interaction modal response.

Note
  A modal response can have a maximum of five rows.

Exceptions

  dpp::logic_exception | if more than five rows are attempted to be added

Returns
  interaction_modal_response& Reference to self

## ◆ build_json() [1/2]

std::string dpp::json_interface< interaction_modal_response >::build_json | ( | bool | with_id = false | ) | const

inline inherited

Convert object to json string.

Parameters

  with_id | Whether to include the ID or not

Note
  Some fields are conditionally filled, do not rely on all fields being present

Returns
  std::string Json built from the structure

## ◆ build_json() [2/2]

std::string dpp::json_interface< interaction_response >::build_json | ( | bool | with_id = false | ) | const

inline inherited

Convert object to json string.

Parameters

  with_id | Whether to include the ID or not

Note
  Some fields are conditionally filled, do not rely on all fields being present

Returns
  std::string Json built from the structure

## ◆ fill_from_json() [1/2]

interaction_modal_response & dpp::json_interface< interaction_modal_response >::fill_from_json | ( | nlohmann::json * | j | ) |

inline inherited

Convert object from nlohmann::json.

Parameters

  j | nlohmann::json object

Returns
  T& Reference to self for fluent calling

## ◆ fill_from_json() [2/2]

interaction_response & dpp::json_interface< interaction_response >::fill_from_json | ( | nlohmann::json * | j | ) |

inline inherited

Convert object from nlohmann::json.

Parameters

  j | nlohmann::json object

Returns
  T& Reference to self for fluent calling

## ◆ fill_from_json_impl()

virtual interaction_modal_response & dpp::interaction_modal_response::fill_from_json_impl | ( | nlohmann::json * | j | ) |

protected virtual

Fill object properties from JSON.

Parameters

  j | JSON to fill from

Returns
  interaction_response& Reference to self

Reimplemented from dpp::interaction_response.

## ◆ operator=() [1/2]

interaction_modal_response & dpp::interaction_modal_response::operator= | ( | const interaction_modal_response & | other | ) |

default

Copy assignment operator.

Parameters

  other | The object to copy from

Returns
  interaction_modal_response& reference to self

## ◆ operator=() [2/2]

interaction_modal_response & dpp::interaction_modal_response::operator= | ( | interaction_modal_response && | other | ) |

default noexcept

Move assignment operator.

Parameters

  other | The object to move from

Returns
  interaction_modal_response& reference to self

## ◆ set_custom_id()

interaction_modal_response & dpp::interaction_modal_response::set_custom_id | ( | const std::string & | _custom_id | ) |

Set the custom id.

Parameters

  _custom_id | custom id to set

Returns
  interaction_modal_response& Reference to self

## ◆ set_title()

interaction_modal_response & dpp::interaction_modal_response::set_title | ( | const std::string & | _title | ) |

Set the title.

Parameters

  _title | title to set

Returns
  interaction_modal_response& Reference to self

## ◆ to_json() [1/2]

auto dpp::json_interface< interaction_modal_response >::to_json | ( | bool | with_id = false | ) | const

inline inherited

Convert object to nlohmann::json.

Parameters

  with_id | Whether to include the ID or not

Note
  Some fields are conditionally filled, do not rely on all fields being present

Returns
  json Json built from the structure

## ◆ to_json() [2/2]

auto dpp::json_interface< interaction_response >::to_json | ( | bool | with_id = false | ) | const

inline inherited

Convert object to nlohmann::json.

Parameters

  with_id | Whether to include the ID or not

Note
  Some fields are conditionally filled, do not rely on all fields being present

Returns
  json Json built from the structure

## ◆ to_json_impl()

virtual json dpp::interaction_modal_response::to_json_impl | ( | bool | with_id = false | ) | const

protected virtual

Build a json for this object.

Parameters

  with_id | include id in json output

Returns
  json JSON object

Reimplemented from dpp::interaction_response.

## Friends And Related Symbol Documentation

## ◆ json_interface< interaction_modal_response >

friend struct json_interface< interaction_modal_response >

friend

## Member Data Documentation

## ◆ autocomplete_choices

std::vector<command_option_choice> dpp::interaction_response::autocomplete_choices {}

inherited

Array of up to 25 autocomplete choices.

## ◆ components

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.

## ◆ current_row

size_t dpp::interaction_modal_response::current_row

protected

## ◆ custom_id

std::string dpp::interaction_modal_response::custom_id

Custom ID for the modal form.

## ◆ msg

message dpp::interaction_response::msg {}

inherited

Message tied to this response.

## ◆ title

std::string dpp::interaction_modal_response::title

Title of the modal form box (max 25 characters).

## ◆ type

interaction_response_type dpp::interaction_response::type {}

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.

D++ Library version 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0