D++ (DPP)
C++ Discord API Bot Library
dpp::interaction_response Struct Reference

A response to an interaction, used to reply to a command and initiate a message, which can be hidden from others (ephemeral) or visible to all. More...

#include <appcommand.h>

+ Inheritance diagram for dpp::interaction_response:
+ Collaboration diagram for dpp::interaction_response:

Public Member Functions

 interaction_response ()
 Construct a new interaction response object. More...
 
 interaction_response (interaction_response_type t, const struct message &m)
 Construct a new interaction response object. More...
 
 interaction_response (interaction_response_type t)
 Construct a new interaction response object. More...
 
interaction_responsefill_from_json (nlohmann::json *j)
 Fill object properties from JSON. More...
 
virtual std::string build_json (bool with_id=false) const
 Build a json string for this object. More...
 
interaction_responseadd_autocomplete_choice (const command_option_choice &achoice)
 Add a command option choice. More...
 
virtual ~interaction_response ()
 Destroy the interaction response object. More...
 

Public Attributes

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. More...
 
struct messagemsg
 A message object. This pointer is always valid while the containing interaction_response exists. More...
 
std::vector< command_option_choiceautocomplete_choices
 Array of up to 25 autocomplete choices. More...
 

Detailed Description

A response to an interaction, used to reply to a command and initiate a message, which can be hidden from others (ephemeral) or visible to all.

The dpp::interaction_response object wraps a dpp::message object. To set the message as 'ephemeral' (e.g. only the command issuer can see it) you should add the dpp::m_ephemeral flag to the dpp::message::flags field. e.g.:

mymessage.flags |= dpp::m_ephemeral;

Constructor & Destructor Documentation

◆ interaction_response() [1/3]

dpp::interaction_response::interaction_response ( )

Construct a new interaction response object.

◆ interaction_response() [2/3]

dpp::interaction_response::interaction_response ( interaction_response_type  t,
const struct message m 
)

Construct a new interaction response object.

Parameters
tType of reply
mMessage to reply with

◆ interaction_response() [3/3]

dpp::interaction_response::interaction_response ( interaction_response_type  t)

Construct a new interaction response object.

Parameters
tType of reply

◆ ~interaction_response()

virtual dpp::interaction_response::~interaction_response ( )
virtual

Destroy the interaction response object.

Member Function Documentation

◆ add_autocomplete_choice()

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

Add a command option choice.

Parameters
achoicecommand option choice to add
Returns
interaction_response& Reference to self

◆ build_json()

virtual std::string dpp::interaction_response::build_json ( bool  with_id = false) const
virtual

Build a json string for this object.

Returns
std::string JSON string

Reimplemented from dpp::json_interface< interaction_response >.

Reimplemented in dpp::interaction_modal_response.

◆ fill_from_json()

interaction_response & dpp::interaction_response::fill_from_json ( nlohmann::json *  j)

Fill object properties from JSON.

Parameters
jJSON to fill from
Returns
interaction_response& Reference to self

Member Data Documentation

◆ autocomplete_choices

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

Array of up to 25 autocomplete choices.

◆ msg

struct message* dpp::interaction_response::msg

A message object. This pointer is always valid while the containing interaction_response exists.

◆ type

interaction_response_type dpp::interaction_response::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.

D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0