discord_set_prefix - set a default prefix for commands#
-
void discord_set_prefix(struct discord *client, char *prefix)#
Set a mandatory prefix before commands.
Example: If ‘help’ is a command and ‘!’ prefix is set, the command will only be validated if ‘!help’ is sent
See also
- Parameters:
client – the client created with discord_init()
prefix – the prefix that should accompany any command
Example#
struct discord *client = discord_init(BOT_TOKEN);
discord_set_prefix(client, "#!");
// triggers at '#!foo'
discord_set_on_command(client, "foo", &callback1);
// triggers at '#!?bar'
discord_set_on_command(client, "?bar", &callback2);
// triggers at '#!_.baz'
discord_set_on_command(client, "_.baz", &callback3);
discord_run(client);
discord_cleanup(client);