Concord - C Discord API library
A Discord API wrapper library written in C
User

User's public API supported by Concord. More...

Collaboration diagram for User:

Modules

 User flags
 Flags on a user account.
 

Data Structures

struct  discord_ret_user
 Request's return context. More...
 
struct  discord_ret_users
 Request's return context. More...
 
struct  discord_ret_connections
 Request's return context. More...
 

Functions

CCORDcode discord_get_current_user (struct discord *client, struct discord_ret_user *ret)
 Get client's user. More...
 
CCORDcode discord_get_user (struct discord *client, u64snowflake user_id, struct discord_ret_user *ret)
 Get user for a given id. More...
 
CCORDcode discord_modify_current_user (struct discord *client, struct discord_modify_current_user *params, struct discord_ret_user *ret)
 Modify client's user account settings. More...
 
CCORDcode discord_get_current_user_guilds (struct discord *client, struct discord_ret_guilds *ret)
 Get guilds client is a member of. More...
 
CCORDcode discord_leave_guild (struct discord *client, u64snowflake guild_id, struct discord_ret *ret)
 Leave a guild. More...
 
CCORDcode discord_create_dm (struct discord *client, struct discord_create_dm *params, struct discord_ret_channel *ret)
 Create a new DM channel with a given user. More...
 
CCORDcode discord_create_group_dm (struct discord *client, struct discord_create_group_dm *params, struct discord_ret_channel *ret)
 Create a new group DM channel with multiple users. More...
 
CCORDcode discord_get_user_connections (struct discord *client, struct discord_ret_connections *ret)
 Get a list of connection objects. More...
 

Detailed Description

User's public API supported by Concord.

Function Documentation

◆ discord_get_current_user()

CCORDcode discord_get_current_user ( struct discord client,
struct discord_ret_user ret 
)

Get client's user.

Parameters
clientthe client created with discord_init()
retreturn context of the request. if successful a discord_user will be sent over to its assigned done callback
See also
discord_ret_user for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ discord_get_user()

CCORDcode discord_get_user ( struct discord client,
u64snowflake  user_id,
struct discord_ret_user ret 
)

Get user for a given id.

Parameters
clientthe client created with discord_init()
user_iduser to be fetched
retreturn context of the request. if successful a discord_user will be sent over to its assigned done callback
See also
discord_ret_user for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ discord_modify_current_user()

CCORDcode discord_modify_current_user ( struct discord client,
struct discord_modify_current_user params,
struct discord_ret_user ret 
)

Modify client's user account settings.

Parameters
clientthe client created with discord_init()
paramsrequest parameters
retreturn context of the request. if successful a discord_user will be sent over to its assigned done callback
See also
discord_ret_user for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ discord_get_current_user_guilds()

CCORDcode discord_get_current_user_guilds ( struct discord client,
struct discord_ret_guilds ret 
)

Get guilds client is a member of.

Note
Requires the guilds oauth2 scope
Parameters
clientthe client created with discord_init()
retreturn context of the request. if successful a discord_guilds will be sent over to its assigned done callback
See also
discord_ret_guilds for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
fetch-messages.c.

◆ discord_leave_guild()

CCORDcode discord_leave_guild ( struct discord client,
u64snowflake  guild_id,
struct discord_ret ret 
)

Leave a guild.

Parameters
clientthe client created with discord_init()
guild_idguild to exit from
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

◆ discord_create_dm()

CCORDcode discord_create_dm ( struct discord client,
struct discord_create_dm params,
struct discord_ret_channel ret 
)

Create a new DM channel with a given user.

Warning
DMs should generally be initiated by a user action. If you open a significant amount of DMs too quickly, your bot may be rate limited or blocked from opening new ones
Parameters
clientthe client created with discord_init()
paramsthe request parameters
retreturn context of the request. if successful a discord_channel will be sent over to its assigned done callback
See also
discord_ret_channel for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
Examples
manual-dm.c.

◆ discord_create_group_dm()

CCORDcode discord_create_group_dm ( struct discord client,
struct discord_create_group_dm params,
struct discord_ret_channel ret 
)

Create a new group DM channel with multiple users.

Note
DMs created with this function will not be shown in the Discord client
Limited to 10 active group DMs
Parameters
clientthe client created with discord_init()
paramsthe request parameters
retreturn context of the request. if successful a discord_channel will be sent over to its assigned done callback
See also
discord_ret_channel for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary

◆ discord_get_user_connections()

CCORDcode discord_get_user_connections ( struct discord client,
struct discord_ret_connections ret 
)

Get a list of connection objects.

Note
Requires the connections oauth2 scope
Parameters
clientthe client created with discord_init()
retreturn context of the request. if successful a discord_connections will be sent over to its assigned done callback
See also
discord_ret_connections for more options
Returns
CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary