D++ (DPP)
C++ Discord API Bot Library
|
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...
Public Member Functions | |
interaction_response ()=default | |
Construct a new interaction response object. More... | |
interaction_response (interaction_response_type t) | |
Construct a new interaction response object. More... | |
interaction_response (interaction_response_type t, const message &m) | |
Construct a new interaction response object. More... | |
interaction_response (interaction_response_type t, message &&m) | |
Construct a new interaction response object. More... | |
interaction_response & | add_autocomplete_choice (const command_option_choice &achoice) |
Add a command option choice. More... | |
virtual | ~interaction_response ()=default |
Destroy the interaction response object. More... | |
interaction_response & | fill_from_json (nlohmann::json *j) |
Convert object from nlohmann::json. More... | |
auto | to_json (bool with_id=false) const |
Convert object to nlohmann::json. More... | |
std::string | build_json (bool with_id=false) const |
Convert object to json string. 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... | |
message | msg {} |
Message tied to this response. More... | |
std::vector< command_option_choice > | autocomplete_choices {} |
Array of up to 25 autocomplete choices. More... | |
Protected Member Functions | |
virtual interaction_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 json for this object. More... | |
Friends | |
struct | json_interface< interaction_response > |
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;
|
default |
Construct a new interaction response object.
dpp::interaction_response::interaction_response | ( | interaction_response_type | t | ) |
Construct a new interaction response object.
t | Type of reply |
dpp::interaction_response::interaction_response | ( | interaction_response_type | t, |
const message & | m | ||
) |
Construct a new interaction response object.
t | Type of reply |
m | Message to reply with |
dpp::interaction_response::interaction_response | ( | interaction_response_type | t, |
message && | m | ||
) |
Construct a new interaction response object.
t | Type of reply |
m | Message to reply with |
|
virtualdefault |
Destroy the interaction response object.
interaction_response& dpp::interaction_response::add_autocomplete_choice | ( | const command_option_choice & | achoice | ) |
Add a command option choice.
achoice | command option choice to add |
|
inlineinherited |
Convert object to json string.
with_id | Whether to include the ID or not |
|
inlineinherited |
Convert object from nlohmann::json.
j | nlohmann::json object |
|
protectedvirtual |
Fill object properties from JSON.
j | JSON to fill from |
Reimplemented in dpp::interaction_modal_response.
|
inlineinherited |
Convert object to nlohmann::json.
with_id | Whether to include the ID or not |
|
protectedvirtual |
Build json for this object.
Reimplemented in dpp::interaction_modal_response.
|
friend |
std::vector<command_option_choice> dpp::interaction_response::autocomplete_choices {} |
Array of up to 25 autocomplete choices.
message dpp::interaction_response::msg {} |
Message tied to this response.
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.