Concord - C Discord API library
A Discord API wrapper library written in C
Slash commands

Receiving and registering slash commands. More...

Collaboration diagram for Slash commands:

Data Structures

struct  discord_ret_application_command
 Request's return context. More...
 
struct  discord_ret_application_commands
 Request's return context. More...
 
struct  discord_ret_application_command_permission
 Request's return context. More...
 
struct  discord_ret_application_command_permissions
 Request's return context. More...
 
struct  discord_ret_guild_application_command_permissions
 Request's return context. More...
 

Functions

CCORDcode discord_get_global_application_commands (struct discord *client, u64snowflake application_id, struct discord_ret_application_commands *ret)
 Fetch all of the global commands for your application. More...
 
CCORDcode discord_create_global_application_command (struct discord *client, u64snowflake application_id, struct discord_create_global_application_command *params, struct discord_ret_application_command *ret)
 Create a new global command. More...
 
CCORDcode discord_get_global_application_command (struct discord *client, u64snowflake application_id, u64snowflake command_id, struct discord_ret_application_command *ret)
 Fetch a global command for your application. More...
 
CCORDcode discord_edit_global_application_command (struct discord *client, u64snowflake application_id, u64snowflake command_id, struct discord_edit_global_application_command *params, struct discord_ret_application_command *ret)
 Edit a global command. More...
 
CCORDcode discord_delete_global_application_command (struct discord *client, u64snowflake application_id, u64snowflake command_id, struct discord_ret *ret)
 Deletes a global command. More...
 
CCORDcode discord_bulk_overwrite_global_application_commands (struct discord *client, u64snowflake application_id, struct discord_application_commands *params, struct discord_ret_application_commands *ret)
 Overwrite existing global application commands. More...
 
CCORDcode discord_get_guild_application_commands (struct discord *client, u64snowflake application_id, u64snowflake guild_id, struct discord_ret_application_commands *ret)
 Fetch all of the guild commands of a given guild. More...
 
CCORDcode discord_create_guild_application_command (struct discord *client, u64snowflake application_id, u64snowflake guild_id, struct discord_create_guild_application_command *params, struct discord_ret_application_command *ret)
 Create a new guild command. More...
 
CCORDcode discord_get_guild_application_command (struct discord *client, u64snowflake application_id, u64snowflake guild_id, u64snowflake command_id, struct discord_ret_application_command *ret)
 Fetch a guild command for your application. More...
 
CCORDcode discord_edit_guild_application_command (struct discord *client, u64snowflake application_id, u64snowflake guild_id, u64snowflake command_id, struct discord_edit_guild_application_command *params, struct discord_ret_application_command *ret)
 Edit a guild command. More...
 
CCORDcode discord_delete_guild_application_command (struct discord *client, u64snowflake application_id, u64snowflake guild_id, u64snowflake command_id, struct discord_ret *ret)
 Deletes a guild command. More...
 
CCORDcode discord_bulk_overwrite_guild_application_commands (struct discord *client, u64snowflake application_id, u64snowflake guild_id, struct discord_bulk_overwrite_guild_application_commands *params, struct discord_ret_application_commands *ret)
 Overwrite existing guild application commands. More...
 
CCORDcode discord_get_guild_application_command_permissions (struct discord *client, u64snowflake application_id, u64snowflake guild_id, struct discord_ret_guild_application_command_permissions *ret)
 Fetches command permissions for all commands in a given guild. More...
 
CCORDcode discord_get_application_command_permissions (struct discord *client, u64snowflake application_id, u64snowflake guild_id, u64snowflake command_id, struct discord_ret_application_command_permission *ret)
 Fetches command permissions for a specific command in a given guild. More...
 

Detailed Description

Receiving and registering slash commands.

Function Documentation

◆ discord_get_global_application_commands()

CCORDcode discord_get_global_application_commands ( struct discord client,
u64snowflake  application_id,
struct discord_ret_application_commands ret 
)

Fetch all of the global commands for your application.

Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
retreturn context of the request. if successful a discord_application_commands will be sent over to its assigned done callback
See also
discord_ret_application_commands for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
slash-commands2.c.

◆ discord_create_global_application_command()

Create a new global command.

Note
New global commands will be available in all guilds after 1 hour
Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
paramsrequest parameters
retreturn context of the request. if successful a discord_application_command will be sent over to its assigned done callback
See also
discord_ret_application_command for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
slash-commands2.c.

◆ discord_get_global_application_command()

CCORDcode discord_get_global_application_command ( struct discord client,
u64snowflake  application_id,
u64snowflake  command_id,
struct discord_ret_application_command ret 
)

Fetch a global command for your application.

Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
command_idthe registered command id
retreturn context of the request. if successful a discord_application_command will be sent over to its assigned done callback
See also
discord_ret_application_command for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ discord_edit_global_application_command()

Edit a global command.

Note
Updates will be available in all guilds after 1 hour
Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
command_idthe registered command id
paramsrequest parameters
retreturn context of the request. if successful a discord_application_command will be sent over to its assigned done callback
See also
discord_ret_application_command for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
slash-commands2.c.

◆ discord_delete_global_application_command()

CCORDcode discord_delete_global_application_command ( struct discord client,
u64snowflake  application_id,
u64snowflake  command_id,
struct discord_ret ret 
)

Deletes a global command.

Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
command_idthe registered command id
retreturn context of the request. if successful the assigned done will be triggered
See also
discord_ret for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
slash-commands2.c.

◆ discord_bulk_overwrite_global_application_commands()

CCORDcode discord_bulk_overwrite_global_application_commands ( struct discord client,
u64snowflake  application_id,
struct discord_application_commands params,
struct discord_ret_application_commands ret 
)

Overwrite existing global application commands.

Note
Updates will be available in all guilds after 1 hour
Warning
Will overwrite all types of application commands: slash commands, user commands, and message commands
Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
paramsthe request parameters, a list of application commands
retreturn context of the request. if successful a discord_application_commands will be sent over to its assigned done callback
See also
discord_ret_application_commands for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ discord_get_guild_application_commands()

CCORDcode discord_get_guild_application_commands ( struct discord client,
u64snowflake  application_id,
u64snowflake  guild_id,
struct discord_ret_application_commands ret 
)

Fetch all of the guild commands of a given guild.

Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
guild_idthe guild where the commands are located
retreturn context of the request. if successful a discord_application_commands will be sent over to its assigned done callback
See also
discord_ret_application_commands for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
slash-commands2.c.

◆ discord_create_guild_application_command()

Create a new guild command.

Note
Commands will be available in the guild immediately
Will overwrite any existing guild command with the same name
Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
guild_idthe guild where the command is located
paramsrequest parameters
retreturn context of the request. if successful a discord_application_command will be sent over to its assigned done callback
See also
discord_ret_application_command for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
slash-commands.c, and slash-commands2.c.

◆ discord_get_guild_application_command()

CCORDcode discord_get_guild_application_command ( struct discord client,
u64snowflake  application_id,
u64snowflake  guild_id,
u64snowflake  command_id,
struct discord_ret_application_command ret 
)

Fetch a guild command for your application.

Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
guild_idthe guild where the command is located
command_idthe registered command id
retreturn context of the request. if successful a discord_application_command will be sent over to its assigned done callback
See also
discord_ret_application_command for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ discord_edit_guild_application_command()

CCORDcode discord_edit_guild_application_command ( struct discord client,
u64snowflake  application_id,
u64snowflake  guild_id,
u64snowflake  command_id,
struct discord_edit_guild_application_command params,
struct discord_ret_application_command ret 
)

Edit a guild command.

Note
Updates for guild commands will be available immediately
Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
guild_idthe guild where the command is located
command_idthe registered command id
paramsrequest parameters
retreturn context of the request. if successful a discord_application_command will be sent over to its assigned done callback
See also
discord_ret_application_command for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
slash-commands2.c.

◆ discord_delete_guild_application_command()

CCORDcode discord_delete_guild_application_command ( struct discord client,
u64snowflake  application_id,
u64snowflake  guild_id,
u64snowflake  command_id,
struct discord_ret ret 
)

Deletes a guild command.

Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
guild_idthe guild where the command is located
command_idthe registered command id
retreturn context of the request. if successful the assigned done will be triggered
See also
discord_ret for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
slash-commands2.c.

◆ discord_bulk_overwrite_guild_application_commands()

Overwrite existing guild application commands.

Warning
This will overwrite all types of application commands: slash commands, user commands, and message commands
Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
guild_idthe guild where the commands are located
paramsthe request parameters, a list of application commands
retreturn context of the request. if successful a discord_application_commands will be sent over to its assigned done callback
See also
discord_ret_application_commands for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ discord_get_guild_application_command_permissions()

CCORDcode discord_get_guild_application_command_permissions ( struct discord client,
u64snowflake  application_id,
u64snowflake  guild_id,
struct discord_ret_guild_application_command_permissions ret 
)

Fetches command permissions for all commands in a given guild.

Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
guild_idthe guild where the commands are located
retreturn context of the request. if successful a discord_guild_application_command_permissions will be sent over to its assigned done callback
See also
discord_ret_guild_application_command_permissions for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ discord_get_application_command_permissions()

CCORDcode discord_get_application_command_permissions ( struct discord client,
u64snowflake  application_id,
u64snowflake  guild_id,
u64snowflake  command_id,
struct discord_ret_application_command_permission ret 
)

Fetches command permissions for a specific command in a given guild.

Parameters
clientthe client created with discord_init()
application_idthe unique id of the parent application
guild_idthe guild where the command is located
command_idthe registered command id
retreturn context of the request. if successful a discord_application_command_permissions will be sent over to its assigned done callback
See also
discord_ret_application_command_permissions for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary