D++ (DPP)
C++ Discord API Bot Library
dpp::interaction Class Reference

An interaction represents a user running a command and arrives via the dpp::cluster::on_interaction_create event. More...

#include <slashcommand.h>

+ Inheritance diagram for dpp::interaction:
+ Collaboration diagram for dpp::interaction:

Public Member Functions

interactionfill_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_interactiondata
 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. 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...
 
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 relavent to us as useful metadata. More...
 

Detailed Description

An interaction represents a user running a command and arrives via the dpp::cluster::on_interaction_create event.

Member Function Documentation

◆ build_json()

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

Build a json string for this object.

Parameters
with_idTrue if to include the ID in the JSON
Returns
std::string JSON string

◆ fill_from_json()

interaction & dpp::interaction::fill_from_json ( nlohmann::json j)

Fill object properties from JSON.

Parameters
jJSON to fill from
Returns
interaction& Reference to self

◆ get_creation_time()

double dpp::managed::get_creation_time ( ) const
inherited

Get the creation time of this object according to Discord.

Returns
double creation time inferred from the snowflake ID. The minimum possible value is the first second of 2015.

Member Data Documentation

◆ application_id

snowflake dpp::interaction::application_id

id of the application this interaction is for

◆ channel_id

snowflake dpp::interaction::channel_id

Optional: the channel it was sent from.

◆ data

std::variant<command_interaction, component_interaction, autocomplete_interaction> dpp::interaction::data

Optional: the command data payload.

◆ guild_id

snowflake dpp::interaction::guild_id

Optional: the guild it was sent from.

◆ id

snowflake dpp::managed::id
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 relavent to us as useful metadata.

◆ member

guild_member dpp::interaction::member

Optional: guild member data for the invoking user, including permissions.

◆ message_id

snowflake dpp::interaction::message_id

Originating message id.

◆ resolved

command_resolved dpp::interaction::resolved

Resolved user/role etc.

◆ token

std::string dpp::interaction::token

a continuation token for responding to the interaction

◆ type

uint8_t dpp::interaction::type

the type of interaction

◆ usr

user dpp::interaction::usr

Optional: user object for the invoking user, if invoked in a DM.

◆ version

uint8_t dpp::interaction::version

read-only property, always 1

D++ 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