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 overridden 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... | |
double | get_creation_time () const |
Get the creation time of this object according to Discord. 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 | version |
autoincrementing version identifier updated during substantial record changes 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 relavent to us as useful metadata. 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 | ( | ) |
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 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.
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 set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relavent to us as useful metadata.
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.
snowflake dpp::slashcommand::version |
autoincrementing version identifier updated during substantial record changes