dpp::slashcommand
dpp::managed
dpp::json_interface< slashcommand >
appcommand.h
struct friend struct json_interface< slashcommand > json_interface< slashcommand > dpp::slashcommand::json_interface< slashcommand > json_interface< slashcommand >
snowflake snowflake dpp::slashcommand::application_id application_id dpp::slashcommand::application_id

Application id (usually matches your bots id).

std::vector< interaction_context_type > std::vector<interaction_context_type> dpp::slashcommand::contexts contexts dpp::slashcommand::contexts

Interaction context(s) where the command can be used, only for globally-scoped commands. By default, all interaction context types included for new commands.

permission permission dpp::slashcommand::default_member_permissions default_member_permissions dpp::slashcommand::default_member_permissions

The default permissions of this command on a guild. D++ defaults this to dpp::p_use_application_commands.

You can set it to 0 to disable the command for everyone except admins by default

bool bool dpp::slashcommand::default_permission default_permission dpp::slashcommand::default_permission

Whether the command is enabled by default when the app is added to a guild. This has no effect as the default_member_permissions value is used instead.

Deprecated

Discord discourage use of this value and instead you should use slashcommand::default_member_permissions.

std::string std::string dpp::slashcommand::description description dpp::slashcommand::description

Command description (1-100 chars).

std::map< std::string, std::string > std::map<std::string, std::string> dpp::slashcommand::description_localizations description_localizations dpp::slashcommand::description_localizations

Localisations of command description.

bool bool dpp::slashcommand::dm_permission dm_permission dpp::slashcommand::dm_permission

True if this command should be allowed in a DM D++ defaults this to false. Cannot be set to true in a guild command, only a global command.

Deprecated

Use dpp::slashcommand_t::set_interaction_contexts instead

snowflake snowflake dpp::managed::id id dpp::managed::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.

std::vector< application_integration_types > std::vector<application_integration_types> dpp::slashcommand::integration_types integration_types dpp::slashcommand::integration_types

Installation contexts where the command is available, only for globally-scoped commands. Defaults to your app's configured contexts.

std::string std::string dpp::slashcommand::name name dpp::slashcommand::name

Command name (1-32 chars).

std::map< std::string, std::string > std::map<std::string, std::string> dpp::slashcommand::name_localizations name_localizations dpp::slashcommand::name_localizations

Localisations of command name.

bool bool dpp::slashcommand::nsfw nsfw dpp::slashcommand::nsfw

Indicates whether the command is age-restricted. Defaults to false.

std::vector< command_option > std::vector<command_option> dpp::slashcommand::options options dpp::slashcommand::options

Command options (parameters).

std::vector< command_permission > std::vector<command_permission> dpp::slashcommand::permissions permissions dpp::slashcommand::permissions

command permissions

Deprecated

Discord discourage use of this value and instead you should use default_member_permissions.

slashcommand_contextmenu_type slashcommand_contextmenu_type dpp::slashcommand::type type dpp::slashcommand::type

Context menu type, defaults to dpp::ctxm_chat_input.

snowflake snowflake dpp::slashcommand::version version dpp::slashcommand::version

autoincrementing version identifier updated during substantial record changes

slashcommand & slashcommand & dpp::slashcommand::fill_from_json_impl (nlohmann::json *j) fill_from_json_impl dpp::slashcommand::fill_from_json_impl nlohmann::json * j

Fill object properties from JSON.

j

JSON to fill from

slashcommand& Reference to self

json json dpp::slashcommand::to_json_impl (bool with_id=false) const to_json_impl dpp::slashcommand::to_json_impl bool with_id false

Build a json for this object.

with_id

True if to include the ID in the JSON

json JSON object

dpp::slashcommand::slashcommand
()
slashcommand
dpp::slashcommand::slashcommand

Construct a new slashcommand object.

dpp::slashcommand::slashcommand
(const std::string &_name, const slashcommand_contextmenu_type _type, const dpp::snowflake _application_id)
slashcommand
dpp::slashcommand::slashcommand
const std::string & _name
const slashcommand_contextmenu_type _type
const dpp::snowflake _application_id

Construct a new slashcommand object.

_name

Command name

_type

Context menu type

_application_id

Application id (usually the bot's user id)

dpp::slashcommand::slashcommand
(const std::string &_name, const std::string &_description, const dpp::snowflake _application_id)
slashcommand
dpp::slashcommand::slashcommand
const std::string & _name
const std::string & _description
const dpp::snowflake _application_id

Construct a new slashcommand object.

_name

Command name

_description

Command description

_application_id

Application id (usually the bot's user id)

virtual dpp::slashcommand::~slashcommand
()=default
~slashcommand
dpp::slashcommand::~slashcommand

Destroy the slashcommand object.

slashcommand & slashcommand & dpp::slashcommand::add_localization (const std::string &language, const std::string &_name, const std::string &_description="") add_localization dpp::slashcommand::add_localization const std::string & language const std::string & _name const std::string & _description ""

Add a localisation for this slash command.

https://discord.com/developers/docs/reference#locales

language

Name of language, see the list of locales linked to above

_name

name of slash command in the specified language

_description

description of slash command in the specified language (optional)

slashcommand& reference to self for chaining of calls

slashcommand & slashcommand & dpp::slashcommand::add_option (const command_option &o) add_option dpp::slashcommand::add_option const command_option & o

Add an option (parameter).

o

option (parameter) to add

slashcommand& reference to self for chaining of calls

slashcommand & slashcommand & dpp::slashcommand::add_permission (const command_permission &p) add_permission dpp::slashcommand::add_permission const command_permission & p

Adds a permission to the command.

p

permission to add

slashcommand& reference to self for chaining of calls

Deprecated

Discord discourage use of this value and instead you should use default_member_permissions.

std::string std::string dpp::json_interface< slashcommand >::build_json (bool with_id=false) const build_json dpp::json_interface< slashcommand >::build_json bool with_id false

Convert object to json string.

with_id

Whether to include the ID or not

Some fields are conditionally filled, do not rely on all fields being present

std::string Json built from the structure

slashcommand & slashcommand & dpp::slashcommand::disable_default_permissions () disable_default_permissions dpp::slashcommand::disable_default_permissions

Disable default permissions, command will be unusable unless permissions are overridden with add_permission and dpp::guild_command_edit_permissions.

slashcommand& reference to self for chaining of calls

Deprecated

Discord discourage use of this value and instead you should use default_member_permissions.

slashcommand & slashcommand & dpp::json_interface< slashcommand >::fill_from_json (nlohmann::json *j) fill_from_json dpp::json_interface< slashcommand >::fill_from_json nlohmann::json * j

Convert object from nlohmann::json.

j

nlohmann::json object

T& Reference to self for fluent calling

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

Get the creation time of this object according to Discord.

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

std::string std::string dpp::slashcommand::get_mention () const get_mention dpp::slashcommand::get_mention

Return a ping/mention for the slash command.

std::string mention. e.g. `</airhorn:816437322781949972>`

If you want a mention for a subcommand or subcommand group, you can use dpp::utility::slashcommand_mention

bool bool dpp::managed::operator!= (const managed &other) const noexcept operator!= dpp::managed::operator!= const managed & other

Comparison operator for comparing two managed objects by id.

other

Other object to compare against

true objects are not the same id

false objects are the same id

bool bool dpp::managed::operator== (const managed &other) const noexcept operator== dpp::managed::operator== const managed & other

Comparison operator for comparing two managed objects by id.

other

Other object to compare against

true objects are the same id

false objects are not the same id

slashcommand & slashcommand & dpp::slashcommand::set_application_id (snowflake i) set_application_id dpp::slashcommand::set_application_id snowflake i

Set the application id of the command.

i

application id

slashcommand& reference to self for chaining of calls

slashcommand & slashcommand & dpp::slashcommand::set_default_permissions (uint64_t defaults) set_default_permissions dpp::slashcommand::set_default_permissions uint64_t defaults

Set the default permissions of the slash command.

defaults

default permissions to set. This is a permission bitmask of bits from dpp::permissions. This is also an AND list, which means the user must have all specified permissions to use the command.

You can set it to 0 to disable the command for everyone except admins by default

slashcommand& reference to self for chaining of calls

slashcommand & slashcommand & dpp::slashcommand::set_description (const std::string &d) set_description dpp::slashcommand::set_description const std::string & d

Set the description of the command.

d

description

The maximum length of a command description is 100 UTF-8 codepoints. If your command description is longer than this, it will be truncated.

slashcommand& reference to self for chaining of calls

slashcommand & slashcommand & dpp::slashcommand::set_dm_permission (bool dm) set_dm_permission dpp::slashcommand::set_dm_permission bool dm

Set the dm permission for the command.

dm

true to allow this command in dms

slashcommand& reference to self for chaining of calls

slashcommand & slashcommand & dpp::slashcommand::set_interaction_contexts (std::vector< interaction_context_type > contexts) set_interaction_contexts dpp::slashcommand::set_interaction_contexts std::vector< interaction_context_type > contexts

Set the interaction contexts for the command.

contexts

the contexts to set

slashcommand& reference to self for chaining of calls

slashcommand & slashcommand & dpp::slashcommand::set_name (const std::string &n) set_name dpp::slashcommand::set_name const std::string & n

Set the name of the command.

n

name of command

The maximum length of a command name is 32 UTF-8 codepoints. If your command name is longer than this, it will be truncated. The command name will be set to lowercase when the type is the default dpp::ctxm_chat_input.

slashcommand& reference to self for chaining of calls

slashcommand & slashcommand & dpp::slashcommand::set_nsfw (bool is_nsfw) set_nsfw dpp::slashcommand::set_nsfw bool is_nsfw

Set whether the command should be age-restricted or not.

is_nsfw

true if the command should be age-restricted

slashcommand& reference to self for chaining of calls

slashcommand & slashcommand & dpp::slashcommand::set_type (slashcommand_contextmenu_type _type) set_type dpp::slashcommand::set_type slashcommand_contextmenu_type _type

Set the type of the slash command (only for context menu entries).

_type

Type of context menu entry this command represents

If the type is dpp::ctxm_chat_input, the command name will be set to lowercase.

slashcommand& reference to self for chaining of calls

auto auto dpp::json_interface< slashcommand >::to_json (bool with_id=false) const to_json dpp::json_interface< slashcommand >::to_json bool with_id false

Convert object to nlohmann::json.

with_id

Whether to include the ID or not

Some fields are conditionally filled, do not rely on all fields being present

json Json built from the structure

Represents an application command, created by your bot either globally, or on a guild.

dpp::json_interface< T >
dpp::json_interface< slashcommand >
< slashcommand >
dpp::managed
dpp::slashcommand
K
T
application_integration_types
bool
channel_type
command_option_type
command_permission_type
dpp::command_option
type
description
name
autocomplete
focused
required
value
choices
options
channel_types
max_value
min_value
description_localizations
name_localizations
file_types
dpp::command_option_choice
name
value
name_localizations
dpp::command_permission
id
type
permission
dpp::json_interface< T >
dpp::json_interface< command_option >
< command_option >
dpp::json_interface< command_option_choice >
< command_option_choice >
dpp::json_interface< command_permission >
< command_permission >
dpp::json_interface< slashcommand >
< slashcommand >
dpp::managed
id
dpp::permission
value
dpp::slashcommand
application_id
version
type
description
name
options
default_permission
dm_permission
nsfw
permissions
description_localizations
name_localizations
default_member_permissions
integration_types
contexts
dpp::snowflake
value
interaction_context_type
slashcommand_contextmenu_type
std::basic_string< Char >
std::map< K, T >
keys
elements
std::map< std::string, std::string >
elements
keys
< std::string, std::string >
std::string
variant< std::monostate, int64_t, double >
variant< std::monostate, std::string, int64_t, bool, snowflake, double >
std::vector< T >
elements
std::vector< application_integration_types >
elements
< application_integration_types >
std::vector< channel_type >
elements
< channel_type >
std::vector< dpp::command_option >
elements
< dpp::command_option >
std::vector< dpp::command_option_choice >
elements
< dpp::command_option_choice >
std::vector< dpp::command_permission >
elements
< dpp::command_permission >
std::vector< interaction_context_type >
elements
< interaction_context_type >
std::vector< std::string >
elements
< std::string >
uint64_t
- dpp::slashcommand
  add_localization
- dpp::slashcommand
  add_option
- dpp::slashcommand
  add_permission
- dpp::slashcommand
  application_id
- dpp::slashcommand
  build_json
- dpp::slashcommand
  contexts
- dpp::slashcommand
  default_member_permissions
- dpp::slashcommand
  default_permission
- dpp::slashcommand
  description
- dpp::slashcommand
  description_localizations
- dpp::slashcommand
  disable_default_permissions
- dpp::slashcommand
  dm_permission
- dpp::slashcommand
  fill_from_json
- dpp::slashcommand
  fill_from_json_impl
- dpp::slashcommand
  get_creation_time
- dpp::slashcommand
  get_mention
- dpp::slashcommand
  id
- dpp::slashcommand
  integration_types
- dpp::slashcommand
  json_interface< slashcommand >
- dpp::slashcommand
  managed
- dpp::slashcommand
  managed
- dpp::slashcommand
  managed
- dpp::slashcommand
  managed
- dpp::slashcommand
  name
- dpp::slashcommand
  name_localizations
- dpp::slashcommand
  nsfw
- dpp::slashcommand
  operator!=
- dpp::slashcommand
  operator=
- dpp::slashcommand
  operator=
- dpp::slashcommand
  operator==
- dpp::slashcommand
  options
- dpp::slashcommand
  permissions
- dpp::slashcommand
  set_application_id
- dpp::slashcommand
  set_default_permissions
- dpp::slashcommand
  set_description
- dpp::slashcommand
  set_dm_permission
- dpp::slashcommand
  set_interaction_contexts
- dpp::slashcommand
  set_name
- dpp::slashcommand
  set_nsfw
- dpp::slashcommand
  set_type
- dpp::slashcommand
  slashcommand
- dpp::slashcommand
  slashcommand
- dpp::slashcommand
  slashcommand
- dpp::slashcommand
  to_json
- dpp::slashcommand
  to_json_impl
- dpp::slashcommand
  type
- dpp::slashcommand
  version
- dpp::slashcommand
  ~managed
- dpp::slashcommand
  ~slashcommand