![]() |
D++ (DPP)
C++ Discord API Bot Library
|
The commandhandler class represents a group of commands, prefixed or slash commands with handling functions. More...
#include <commandhandler.h>
Public Member Functions | |
| commandhandler () | |
| ~commandhandler () | |
| commandhandler & | add_command (const std::string &command, command_handler handler) |
| Add a command to the command handler. More... | |
| commandhandler & | add_prefix (const std::string &prefix) |
| Add a prefix to the command handler. More... | |
| void | reply (const dpp::message &m) |
| Reply to a message. You should use this method rather than cluster::message_create as the way you reply varies between slash commands and message commands. More... | |
| void | route (const class dpp::command_interaction &cmd) |
| Route a command from the on_interaction_create function. Call this method from yuor on_interaction_create with the recieved dpp::command_interaction object. More... | |
| void | route (const class dpp::message &msg) |
| Route a command from the on_message_create function. Call this method from within your on_message_create with the received dpp::message object. More... | |
The commandhandler class represents a group of commands, prefixed or slash commands with handling functions.
| dpp::commandhandler::commandhandler | ( | ) |
Constructor
| dpp::commandhandler::~commandhandler | ( | ) |
Destructor
| commandhandler & dpp::commandhandler::add_command | ( | const std::string & | command, |
| command_handler | handler | ||
| ) |
Add a command to the command handler.
| command | Command to be handled. Note that if any one of your prefixes is "/" this will attempt to register a global command using the API and you will receive notification of this command via an interaction event. |
| handler | Handler function |
| commandhandler & dpp::commandhandler::add_prefix | ( | const std::string & | prefix | ) |
Add a prefix to the command handler.
| prefix | Prefix to be handled by the command handler |
| void dpp::commandhandler::reply | ( | const dpp::message & | m | ) |
Reply to a message. You should use this method rather than cluster::message_create as the way you reply varies between slash commands and message commands.
| m | message to reply with. |
| void dpp::commandhandler::route | ( | const class dpp::command_interaction & | cmd | ) |
Route a command from the on_interaction_create function. Call this method from yuor on_interaction_create with the recieved dpp::command_interaction object.
| cmd | command interaction to parse |
| void dpp::commandhandler::route | ( | const class dpp::message & | msg | ) |
Route a command from the on_message_create function. Call this method from within your on_message_create with the received dpp::message object.
| msg | message to parse |