Discord.C++ 0.13.0
Loading...
Searching...
No Matches
DiscordCPP::Interaction Class Reference

#include <Interaction.h>

Inheritance diagram for DiscordCPP::Interaction:
DiscordCPP::DiscordObject

Public Types

enum  Type {
  PING = 1 , APPLICATION_COMMAND = 2 , MESSAGE_COMPONENT = 3 , APPLICATION_COMMAND_AUTOCOMPLETE = 4 ,
  MODAL_SUBMIT = 5
}
 

Public Member Functions

 Interaction (const json &data, const std::string &token)
 
void reply (const std::string &content, const bool tts=false)
 Send a Message as a reply to this interaction.
 
void reply (Embed embed)
 Send an Embed as a reply to this interaction.
 
void update_reply (const std::string &content, const bool tts=false)
 Update a previously sent reply for this interaction.
 
void update_reply (Embed embed)
 Update a previously sent reply for this interaction.
 
std::string get_application_id ()
 
Type get_type ()
 
std::optional< InteractionDataget_data ()
 
std::optional< std::string > get_guild_id ()
 
std::optional< std::string > get_channel_id ()
 
std::optional< Memberget_member ()
 
std::optional< Userget_user ()
 
std::optional< Messageget_message ()
 
std::optional< std::string > get_locale ()
 
std::optional< std::string > get_guild_locale ()
 
- Public Member Functions inherited from DiscordCPP::DiscordObject
 DiscordObject ()=default
 
 DiscordObject (std::string token)
 
 DiscordObject (std::string token, std::string id)
 
std::string get_id () const
 

Additional Inherited Members

- Protected Member Functions inherited from DiscordCPP::DiscordObject
std::string get_token () const
 
json api_call (const std::string &url, const std::string &method="GET", const json &data=json(), const std::string &content_type="", const bool cache=true)
 helper function to communicate with the http api
 

Member Enumeration Documentation

◆ Type

Enumerator
PING 
APPLICATION_COMMAND 
MESSAGE_COMPONENT 
APPLICATION_COMMAND_AUTOCOMPLETE 
MODAL_SUBMIT 

Constructor & Destructor Documentation

◆ Interaction()

DiscordCPP::Interaction::Interaction ( const json & data,
const std::string & token )

Member Function Documentation

◆ get_application_id()

std::string DiscordCPP::Interaction::get_application_id ( )
inline
Returns
ID of the application this interaction is for.

◆ get_channel_id()

std::optional< std::string > DiscordCPP::Interaction::get_channel_id ( )
inline
Returns
The channel the interaction was sent from.

◆ get_data()

std::optional< InteractionData > DiscordCPP::Interaction::get_data ( )
inline
Returns
The command data payload.

◆ get_guild_id()

std::optional< std::string > DiscordCPP::Interaction::get_guild_id ( )
inline
Returns
The guild the interaction was sent from.

◆ get_guild_locale()

std::optional< std::string > DiscordCPP::Interaction::get_guild_locale ( )
inline
Returns
The guild's preferred locale.

◆ get_locale()

std::optional< std::string > DiscordCPP::Interaction::get_locale ( )
inline
Returns
The selected locale of the user who sent this interaction.

◆ get_member()

std::optional< Member > DiscordCPP::Interaction::get_member ( )
inline
Returns
The member that sent the interaction.

◆ get_message()

std::optional< Message > DiscordCPP::Interaction::get_message ( )
inline
Returns
For components, the message they were attached to.

◆ get_type()

Type DiscordCPP::Interaction::get_type ( )
inline
Returns
The type of the invoked command.

◆ get_user()

std::optional< User > DiscordCPP::Interaction::get_user ( )
inline
Returns
The user that sent the interaction.

◆ reply() [1/2]

void DiscordCPP::Interaction::reply ( const std::string & content,
const bool tts = false )

Send a Message as a reply to this interaction.

◆ reply() [2/2]

void DiscordCPP::Interaction::reply ( Embed embed)

Send an Embed as a reply to this interaction.

◆ update_reply() [1/2]

void DiscordCPP::Interaction::update_reply ( const std::string & content,
const bool tts = false )

Update a previously sent reply for this interaction.

◆ update_reply() [2/2]

void DiscordCPP::Interaction::update_reply ( Embed embed)

Update a previously sent reply for this interaction.


The documentation for this class was generated from the following files: