Discord Social SDK
|
Although the SDK does not require you to have a backend, for those who do, there are a number of APIs that can be invoked server to server. How these calls are made and structured and authenticated is documented on our developer portal here: https://discord.com/developers/docs/reference
You'll need to use a "bot token" to authenticate these calls which can be found in the setting of the application you created above. And be sure the token is prefixed with Bot
or it won't work!
Discord publishes an Open API Spec at https://github.com/discord/discord-api-spec, and this can be used to generate a client in your preferred backend language to make it easier to call the various APIs. A good tool for that is https://openapi-generator.tech/
For Python for example that might look like this:
/lobbies
Creates a new discordpp::LobbyHandle, adding any of the specified members to it if necessary. Clients will not be able to join or leave a lobby created using this API via the SDK functions (such as discordpp::Client::CreateOrJoinLobby). Returns the created Lobby object.
Field | Type | Description |
---|---|---|
metadata? | Dict<string, string> | An optional dictionary of string key/value pairs. The max total length is 1000. |
members? | Array<LobbyMember> | An optional array of up to 25 users to be added to the lobby |
idle_timeout_seconds? | integer | How long to wait before shutting down a lobby when it is idle. The value can be between 5 and 604800 (7 days). See discordpp::LobbyHandle for more details on this behavior. |
Field | Type | Description |
---|---|---|
id | snowflake | The Discord user id of the user to add |
metadata? | Dict<string, string> | An optional dictionary of string key/value pairs. The max total length is 1000. |
flags? | integer | Currently the only supported flag is CanLinkLobby which is 1<<0 |
/lobbies/<lobby_id>
Updates the lobby with the new fields, returns the updated Lobby object.
Field | Type | Description |
---|---|---|
metadata? | Dict<string, string> | An optional dictionary of string key/value pairs. The max total length is 1000. Overwrites any existing metadata. |
members? | Array<LobbyMember> | An optional array of up to 25 users to replace the lobby members with. If provided, lobby members not in this list will be removed from the lobby. |
idle_timeout_seconds? | integer | How long to wait before shutting down a lobby when it is idle. The value can be between 5 and 604800 (7 days). See discordpp::LobbyHandle for more details on this behavior. |
/lobbies/<lobby_id>
Deletes the specified lobby if it exists. Returns nothing. Is safe to call even if the lobby is already deleted as well.
/lobbies/<lobby_id>
Returns the Lobby object for the specified lobby if it exists.
/lobbies/<lobby_id>/members/<user_id>
Adds the given user to the specified lobby. If called when the user is already a member of the lobby will update fields such as metadata on that user instead. Returns the LobbyMember object.
Field | Type | Description |
---|---|---|
metadata? | Dict<string, string> | An optional dictionary of string key/value pairs. The max total length is 1000. |
flags? | integer | Currently the only supported flag is CanLinkLobby which is 1<<0 |
/lobbies/<lobby_id>/members/<user_id>
Removes the given user from the specified lobby. Returns nothing. It is safe to call this even if the user is no longer a member of the lobby, but will fail if the lobby does not exist.
These are the current rate limits that are configured, but if any of these are a problem please reach out and let us know and we can work with you on it!