D++ (DPP)  10.0.30
C++ Discord API Bot Library
appcommand.h File Reference
#include <dpp/export.h>
#include <dpp/snowflake.h>
#include <dpp/managed.h>
#include <dpp/message.h>
#include <dpp/channel.h>
#include <dpp/role.h>
#include <dpp/user.h>
#include <dpp/entitlement.h>
#include <variant>
#include <map>
#include <dpp/json_fwd.h>
#include <dpp/json_interface.h>
Include dependency graph for appcommand.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  dpp::autocomplete_interaction
 An auto complete interaction. More...
 
struct  dpp::command_data_option
 Values in the command interaction. More...
 
struct  dpp::command_interaction
 Details of a command within an interaction. More...
 
struct  dpp::command_option
 Each command option is a command line parameter. More...
 
struct  dpp::command_option_choice
 This struct represents choices in a multiple choice option for a command parameter. More...
 
class  dpp::command_permission
 Application command permissions allow you to enable or disable commands for specific users or roles within a guild. More...
 
struct  dpp::command_resolved
 Resolved snowflake ids to users, guild members, roles and channels. More...
 
struct  dpp::component_interaction
 A button click for a button component. More...
 
class  dpp::guild_command_permissions
 Returned when fetching the permissions for a command in a guild. More...
 
class  dpp::interaction
 An interaction represents a user running a command and arrives via the dpp::cluster::on_interaction_create event. More...
 
struct  dpp::interaction_modal_response
 Represents a modal dialog box response to an interaction. More...
 
struct  dpp::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. More...
 
class  dpp::slashcommand
 Represents an application command, created by your bot either globally, or on a guild. More...
 

Namespaces

 dpp
 The main namespace for D++ functions.
 

Macros

#define AUTOCOMPLETE_MAX_CHOICES   25
 Discord limits the maximum number of replies to an autocomplete interaction to 25. More...
 

Typedefs

typedef std::variant< std::monostate, int64_t, double > dpp::command_option_range
 A minimum or maximum value/length for dpp::co_number, dpp::co_integer and dpp::co_string types of a dpp::command_option. More...
 
typedef std::variant< std::monostate, std::string, int64_t, bool, snowflake, double > dpp::command_value
 This type is a variant that can hold any of the potential native data types represented by the enum dpp::command_option_type. More...
 
typedef std::unordered_map< snowflake, guild_command_permissions > dpp::guild_command_permissions_map
 A group of guild command permissions. More...
 
typedef std::unordered_map< snowflake, slashcommand > dpp::slashcommand_map
 A group of application slash commands. More...
 

Enumerations

enum  dpp::command_option_type : uint8_t {
  dpp::co_sub_command = 1,
  dpp::co_sub_command_group = 2,
  dpp::co_string = 3,
  dpp::co_integer = 4,
  dpp::co_boolean = 5,
  dpp::co_user = 6,
  dpp::co_channel = 7,
  dpp::co_role = 8,
  dpp::co_mentionable = 9,
  dpp::co_number = 10,
  dpp::co_attachment = 11
}
 Represents command option types. More...
 
enum  dpp::command_permission_type {
  dpp::cpt_role = 1,
  dpp::cpt_user = 2
}
 type of permission in the dpp::command_permission class More...
 
enum  dpp::interaction_response_type {
  dpp::ir_pong = 1,
  dpp::ir_channel_message_with_source = 4,
  dpp::ir_deferred_channel_message_with_source = 5,
  dpp::ir_deferred_update_message = 6,
  dpp::ir_update_message = 7,
  dpp::ir_autocomplete_reply = 8,
  dpp::ir_modal_dialog = 9,
  dpp::ir_premium_required = 10
}
 Response types when responding to an interaction within on_interaction_create. More...
 
enum  dpp::interaction_type {
  dpp::it_ping = 1,
  dpp::it_application_command = 2,
  dpp::it_component_button = 3,
  dpp::it_autocomplete = 4,
  dpp::it_modal_submit = 5
}
 Types of interaction in the dpp::interaction class. More...
 
enum  dpp::slashcommand_contextmenu_type {
  dpp::ctxm_none = 0,
  dpp::ctxm_chat_input = 1,
  dpp::ctxm_user = 2,
  dpp::ctxm_message = 3
}
 Right-click context menu types. More...
 

Functions

void dpp::from_json (const nlohmann::json &j, autocomplete_interaction &ai)
 helper function to deserialize an autocomplete_interaction from json More...
 
void dpp::from_json (const nlohmann::json &j, command_data_option &cdo)
 helper function to deserialize a command_data_option from json More...
 
void dpp::from_json (const nlohmann::json &j, command_interaction &ci)
 helper function to deserialize a command_interaction from json More...
 
void dpp::from_json (const nlohmann::json &j, component_interaction &bi)
 helper function to deserialize a component_interaction from json More...
 
void dpp::from_json (const nlohmann::json &j, interaction &i)
 helper function to deserialize an interaction from json More...
 
void dpp::to_json (nlohmann::json &j, const command_option &opt)
 helper function to serialize a command_option to json More...
 
void dpp::to_json (nlohmann::json &j, const command_option_choice &choice)
 helper function to serialize a command_option_choice to json More...
 
void dpp::to_json (nlohmann::json &j, const command_permission &cp)
 helper function to serialize a command_permission to json More...
 
void dpp::to_json (nlohmann::json &j, const guild_command_permissions &gcp)
 helper function to serialize a guild_command_permissions to json More...
 
void dpp::to_json (nlohmann::json &j, const slashcommand &cmd)
 helper function to serialize a slashcommand to json More...
 

Macro Definition Documentation

◆ AUTOCOMPLETE_MAX_CHOICES

#define AUTOCOMPLETE_MAX_CHOICES   25

Discord limits the maximum number of replies to an autocomplete interaction to 25.

This value represents that maximum. interaction_response::add_autocomplete_choice does not allow adding more than this number of elements to the vector.