D++ (DPP)
C++ Discord API Bot Library
|
An interaction represents a user running a command and arrives via the dpp::cluster::on_interaction_create event. More...
#include <appcommand.h>
Public Member Functions | |
interaction () | |
Construct a new interaction object. More... | |
virtual | ~interaction ()=default |
command_interaction | get_command_interaction () const |
Get the command interaction object. More... | |
component_interaction | get_component_interaction () const |
Get the component interaction object. More... | |
autocomplete_interaction | get_autocomplete_interaction () const |
Get the autocomplete interaction object. More... | |
std::string | get_command_name () const |
Get the command name for a command interaction. More... | |
interaction & | fill_from_json (nlohmann::json *j) |
Fill object properties from JSON. More... | |
std::string | build_json (bool with_id=false) const |
Build a json string for this object. More... | |
double | get_creation_time () const |
Get the creation time of this object according to Discord. More... | |
Public Attributes | |
snowflake | application_id |
id of the application this interaction is for More... | |
uint8_t | type |
the type of interaction More... | |
std::variant< command_interaction, component_interaction, autocomplete_interaction > | data |
Optional: the command data payload. More... | |
snowflake | guild_id |
Optional: the guild it was sent from. More... | |
snowflake | channel_id |
Optional: the channel it was sent from. More... | |
snowflake | message_id |
Originating message id for context menu actions. More... | |
message | msg |
Originating message for context menu actions. More... | |
guild_member | member |
Optional: guild member data for the invoking user, including permissions. More... | |
user | usr |
Optional: user object for the invoking user, if invoked in a DM. More... | |
std::string | token |
a continuation token for responding to the interaction More... | |
uint8_t | version |
read-only property, always 1 More... | |
command_resolved | resolved |
Resolved user/role etc. More... | |
std::string | locale |
User's locale (language) More... | |
std::string | guild_locale |
Guild's locale (language) - for guild interactions only. More... | |
cache_policy_t | cache_policy |
Cache policy from cluster. More... | |
snowflake | id |
Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata. More... | |
An interaction represents a user running a command and arrives via the dpp::cluster::on_interaction_create event.
dpp::interaction::interaction | ( | ) |
Construct a new interaction object.
|
virtualdefault |
|
virtual |
Build a json string for this object.
with_id | True if to include the ID in the JSON |
Reimplemented from dpp::json_interface< interaction >.
interaction & dpp::interaction::fill_from_json | ( | nlohmann::json * | j | ) |
Fill object properties from JSON.
j | JSON to fill from |
autocomplete_interaction dpp::interaction::get_autocomplete_interaction | ( | ) | const |
Get the autocomplete interaction object.
dpp::logic_exception | if the interaction is not for an autocomplete |
command_interaction dpp::interaction::get_command_interaction | ( | ) | const |
Get the command interaction object.
dpp::logic_exception | if the interaction is not for a command |
std::string dpp::interaction::get_command_name | ( | ) | const |
Get the command name for a command interaction.
component_interaction dpp::interaction::get_component_interaction | ( | ) | const |
Get the component interaction object.
dpp::logic_exception | if the interaction is not for a component |
|
inherited |
Get the creation time of this object according to Discord.
snowflake dpp::interaction::application_id |
id of the application this interaction is for
cache_policy_t dpp::interaction::cache_policy |
Cache policy from cluster.
snowflake dpp::interaction::channel_id |
Optional: the channel it was sent from.
std::variant<command_interaction, component_interaction, autocomplete_interaction> dpp::interaction::data |
Optional: the command data payload.
snowflake dpp::interaction::guild_id |
Optional: the guild it was sent from.
std::string dpp::interaction::guild_locale |
Guild's locale (language) - for guild interactions only.
|
inherited |
Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata.
std::string dpp::interaction::locale |
User's locale (language)
guild_member dpp::interaction::member |
Optional: guild member data for the invoking user, including permissions.
snowflake dpp::interaction::message_id |
Originating message id for context menu actions.
message dpp::interaction::msg |
Originating message for context menu actions.
command_resolved dpp::interaction::resolved |
Resolved user/role etc.
std::string dpp::interaction::token |
a continuation token for responding to the interaction
uint8_t dpp::interaction::type |
the type of interaction
user dpp::interaction::usr |
Optional: user object for the invoking user, if invoked in a DM.
uint8_t dpp::interaction::version |
read-only property, always 1