D++ (DPP)
C++ Discord API Bot Library
|
Represents an application command, created by your bot either globally, or on a guild. More...
#include <slashcommand.h>
Public Member Functions | |
slashcommand () | |
Construct a new slashcommand object. More... | |
~slashcommand () | |
Destroy the slashcommand object. More... | |
slashcommand & | add_option (const command_option &o) |
Add an option (parameter) More... | |
slashcommand & | set_type (slashcommand_contextmenu_type _type) |
Set the type of the slash command (only for context menu entries) More... | |
slashcommand & | set_name (const std::string &n) |
Set the name of the command. More... | |
slashcommand & | set_description (const std::string &d) |
Set the description of the command. More... | |
slashcommand & | set_application_id (snowflake i) |
Set the application id of the command. More... | |
slashcommand & | add_permission (const command_permission &p) |
Adds a permission to the command. More... | |
slashcommand & | disable_default_permissions () |
Disable default permissions, command will be unusable unless permissions are overriden with add_permission and dpp::guild_command_edit_permissions. More... | |
slashcommand & | fill_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... | |
Public Attributes | |
snowflake | application_id |
Application id (usually matches your bots id) More... | |
slashcommand_contextmenu_type | type |
Context menu type, defaults to none. More... | |
std::string | name |
Command name (1-32 chars) More... | |
std::string | description |
Command description (1-100 chars) More... | |
std::vector< command_option > | options |
Command options (parameters) More... | |
bool | default_permission |
whether the command is enabled by default when the app is added to a guild More... | |
std::vector< command_permission > | permissions |
command permissions More... | |
snowflake | id |
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 | ( | ) |
Destroy the slashcommand object.
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 |
std::string dpp::slashcommand::build_json | ( | bool | with_id = false | ) | const |
Build a json string for this object.
with_id | True if to include the ID in the JSON |
slashcommand & dpp::slashcommand::disable_default_permissions | ( | ) |
Disable default permissions, command will be unusable unless permissions are overriden 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 |
slashcommand & dpp::slashcommand::set_application_id | ( | snowflake | i | ) |
Set the application id of the command.
i | application id |
slashcommand & dpp::slashcommand::set_description | ( | const std::string & | d | ) |
Set the description of the command.
d | description |
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)
bool dpp::slashcommand::default_permission |
whether the command is enabled by default when the app is added to a guild
std::string dpp::slashcommand::description |
Command description (1-100 chars)
|
inherited |
Unique ID of object
std::string dpp::slashcommand::name |
Command name (1-32 chars)
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 none.