![]() |
D++ (DPP)
C++ Discord API Bot Library
|
Represents an application command, created by your bot either globally, or on a guild. More...
#include <appcommand.h>
Inheritance diagram for dpp::slashcommand:
Collaboration diagram for dpp::slashcommand:Public Member Functions | |
| slashcommand () | |
| Construct a new slashcommand object. More... | |
| slashcommand (const std::string &_name, const std::string &_description, const dpp::snowflake _application_id) | |
| Construct a new slashcommand object. More... | |
| virtual | ~slashcommand () |
| Destroy the slashcommand object. More... | |
| slashcommand & | add_localization (const std::string &language, const std::string &_name, const std::string &_description) |
| Add a localisation for this slash command. More... | |
| slashcommand & | add_option (const command_option &o) |
| Add an option (parameter) More... | |
| slashcommand & | add_permission (const command_permission &p) |
| Adds a permission to the command. More... | |
| std::string | build_json (bool with_id=false) const |
| Build a json string for this object. More... | |
| slashcommand & | disable_default_permissions () |
| Disable default permissions, command will be unusable unless permissions are overridden with add_permission and dpp::guild_command_edit_permissions. More... | |
| slashcommand & | fill_from_json (nlohmann::json *j) |
| Fill object properties from JSON. More... | |
| double | get_creation_time () const |
| Get the creation time of this object according to Discord. More... | |
| bool | operator!= (const managed &other) const noexcept |
| Comparison operator for comparing two managed objects by id. More... | |
| bool | operator== (const managed &other) const noexcept |
| Comparison operator for comparing two managed objects by id. More... | |
| slashcommand & | set_application_id (snowflake i) |
| Set the application id of the command. More... | |
| slashcommand & | set_default_permissions (uint64_t defaults) |
| Set the default permissions of the slash command. More... | |
| slashcommand & | set_description (const std::string &d) |
| Set the description of the command. More... | |
| slashcommand & | set_dm_permission (bool dm) |
| Set the dm permission for the command. More... | |
| slashcommand & | set_name (const std::string &n) |
| Set the name of the command. More... | |
| slashcommand & | set_type (slashcommand_contextmenu_type _type) |
| Set the type of the slash command (only for context menu entries) More... | |
Public Attributes | |
| snowflake | application_id |
| Application id (usually matches your bots id) More... | |
| permission | default_member_permissions |
| The default permissions of this command on a guild. D++ defaults this to p_use_application_commands. More... | |
| bool | 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. More... | |
| std::string | description |
| Command description (1-100 chars) More... | |
| std::map< std::string, std::string > | description_localizations |
| Localisations of command description. More... | |
| bool | 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. 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... | |
| std::string | name |
| Command name (1-32 chars) More... | |
| std::map< std::string, std::string > | name_localizations |
| Localisations of command name. More... | |
| std::vector< command_option > | options |
| Command options (parameters) More... | |
| std::vector< command_permission > | permissions |
| command permissions More... | |
| slashcommand_contextmenu_type | type |
| Context menu type, defaults to dpp::ctxm_chat_input. More... | |
| snowflake | version |
| autoincrementing version identifier updated during substantial record changes More... | |
Represents an application command, created by your bot either globally, or on a guild.
| dpp::slashcommand::slashcommand | ( | ) |
Construct a new slashcommand object.
| 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 |
Destroy the slashcommand object.
| slashcommand & dpp::slashcommand::add_localization | ( | const std::string & | language, |
| const std::string & | _name, | ||
| const std::string & | _description | ||
| ) |
Add a localisation for this slash command.
| 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 |
| slashcommand & dpp::slashcommand::add_option | ( | const command_option & | o | ) |
Add an option (parameter)
| o | option (parameter) to add |
| slashcommand & dpp::slashcommand::add_permission | ( | const command_permission & | p | ) |
Adds a permission to the command.
| p | permission to add |
|
virtual |
Build a json string for this object.
| with_id | True if to include the ID in the JSON |
Reimplemented from dpp::json_interface< slashcommand >.
| slashcommand & 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 & dpp::slashcommand::fill_from_json | ( | nlohmann::json * | j | ) |
Fill object properties from JSON.
| j | JSON to fill from |
|
inherited |
Get the creation time of this object according to Discord.
|
noexceptinherited |
Comparison operator for comparing two managed objects by id.
| other | Other object to compare against |
|
noexceptinherited |
Comparison operator for comparing two managed objects by id.
| other | Other object to compare against |
| slashcommand & dpp::slashcommand::set_application_id | ( | snowflake | i | ) |
Set the application id of the command.
| i | application id |
| slashcommand & 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 |
| slashcommand & dpp::slashcommand::set_description | ( | const std::string & | d | ) |
Set the description of the command.
| d | description |
| slashcommand & dpp::slashcommand::set_dm_permission | ( | bool | dm | ) |
Set the dm permission for the command.
| dm | true to allow this command in dms |
| slashcommand & dpp::slashcommand::set_name | ( | const std::string & | n | ) |
Set the name of the command.
| n | name of command |
| slashcommand & 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 |
| snowflake dpp::slashcommand::application_id |
Application id (usually matches your bots id)
| permission dpp::slashcommand::default_member_permissions |
The default permissions of this command on a guild. D++ defaults this to p_use_application_commands.
| bool 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.
| std::string dpp::slashcommand::description |
Command description (1-100 chars)
| std::map<std::string, std::string> dpp::slashcommand::description_localizations |
Localisations of command description.
| bool 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.
|
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::slashcommand::name |
Command name (1-32 chars)
| std::map<std::string, std::string> dpp::slashcommand::name_localizations |
Localisations of command name.
| std::vector<command_option> dpp::slashcommand::options |
Command options (parameters)
| std::vector<command_permission> dpp::slashcommand::permissions |
command permissions
| slashcommand_contextmenu_type dpp::slashcommand::type |
Context menu type, defaults to dpp::ctxm_chat_input.
| snowflake dpp::slashcommand::version |
autoincrementing version identifier updated during substantial record changes