The Message Commands API for registering and parsing user commands.
More...
|
void | discord_message_commands_init (struct discord_message_commands *cmds, struct logconf *conf) |
| Initialize a Message Commands handle. More...
|
|
void | discord_message_commands_cleanup (struct discord_message_commands *cmds) |
| Free a Message Commands handle. More...
|
|
discord_ev_message | discord_message_commands_find (struct discord_message_commands *cmds, const char command[], size_t length) |
| Search for a callback matching the command. More...
|
|
void | discord_message_commands_append (struct discord_message_commands *cmds, const char command[], size_t length, discord_ev_message callback) |
| Add a new command/callback pair, or update an existing command. More...
|
|
void | discord_message_commands_set_prefix (struct discord_message_commands *cmds, const char prefix[], size_t length) |
| Set a mandatory prefix before commands. More...
|
|
bool | discord_message_commands_try_perform (struct discord_message_commands *cmds, struct discord_gateway_payload *payload) |
| Read the current DISCORD_EV_MESSAGE_CREATE payload and attempt to perform its matching callback. More...
|
|
The Message Commands API for registering and parsing user commands.
◆ discord_message_commands_init()
Initialize a Message Commands handle.
- Parameters
-
cmds | the message commands handle to be initialized |
conf | pointer to discord logging module |
◆ discord_message_commands_cleanup()
Free a Message Commands handle.
- Parameters
-
◆ discord_message_commands_find()
Search for a callback matching the command.
- Parameters
-
- Returns
- the callback match,
NULL
in case there wasn't a match
◆ discord_message_commands_append()
Add a new command/callback pair, or update an existing command.
- Parameters
-
cmds | the handle initialized with discord_message_commands_init() |
command | the message command to be matched with callback |
length | the command length |
callback | the callback to be triggered when the command is sent |
◆ discord_message_commands_set_prefix()
Set a mandatory prefix before commands.
- See also
- discord_set_on_command()
Example: If 'help' is a command and '!' prefix is set, the command will only be validated if '!help' is sent
- Parameters
-
◆ discord_message_commands_try_perform()
Read the current DISCORD_EV_MESSAGE_CREATE payload and attempt to perform its matching callback.
- Parameters
-
- Returns
true
if the callback has been performed