Skip to content
Francisco Dias edited this page May 13, 2026 · 1 revision

Client

Discord Class: discordpp::Client

The Client module is the main entry point for the Discord Social extension. All functionality is exposed through the functions in this module.

See the Discord Social SDK Getting Started for more information on how to use the functions in the Client module.

Functions

These are the functions in the Client module:



Back To Top

discord_social_client_get_application_id

Discord Function: discordpp::Client::GetApplicationId

This function is used to get the application ID for the client. This is used to identify the application to the Discord client. This is used for things like authentication, rich presence, and activity invites when not connected with discord_social_client_connect. When calling discord_social_client_connect, the application ID is set automatically.


Syntax:

discord_social_client_get_application_id()

Returns:

Real



Back To Top

discord_social_client_set_application_id

Discord Function: discordpp::Client::SetApplicationId

This function is used to set the application ID for the client. This is used to identify the application to the Discord client. This is used for things like authentication, rich presence, and activity invites when not connected with discord_social_client_connect. When calling discord_social_client_connect, the application ID is set automatically.


Syntax:

discord_social_client_set_application_id(application_id)
Argument Type Description
application_id Real The application ID.

Returns:

N/A



Back To Top

discord_social_client_end_call

Discord Function: discordpp::Client::EndCall()

This function ends any active call, if any. Any references you have to Call objects are invalid after they are ended, and can be immediately freed.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_end_call(channel_id, callback)
Argument Type Description
channel_id Real The ID of the lobby with which this call is associated.
callback Function The function to call after completion.

Returns:

N/A


Triggers:

Callback

This is triggered when the function completes.



Back To Top

discord_social_client_end_calls

Discord Function: discordpp::Client::EndCalls()

This function ends any active call, if any. Any references you have to Call objects are invalid after they are ended, and can be immediately freed.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_end_calls(callback)
Argument Type Description
callback Function The function to call after completion.

Returns:

N/A


Triggers:

Callback

This is triggered when the function completes.



Back To Top

discord_social_client_get_call

Discord Function: discordpp::Client::GetCall()

This function returns a reference to the currently active call, if any.


Syntax:

discord_social_client_get_call(channel_id)
Argument Type Description
channel_id Real The ID of the channel.

Returns:

DiscordCall



Back To Top

discord_social_client_get_calls

Discord Function: discordpp::Client::GetCalls()

This function returns a reference to all currently active calls, if any.


Syntax:

discord_social_client_get_calls()

Returns:

Array of DiscordCall



Back To Top

discord_social_client_get_current_input_device

Discord Function: discordpp::Client::GetCurrentInputDevice()

This function asynchronously fetches the current audio input device in use by the client.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_current_input_device(callback)
Argument Type Description
callback Function The callback function to trigger on completion.

Returns:

N/A


Triggers:

Callback

This is triggered when the request completes.

Key Type Description
device DiscordAudioDevice Struct holding information on the input device.


Back To Top

discord_social_client_get_current_output_device

Discord Function: discordpp::Client::GetCurrentOutputDevice()

This function asynchronously fetches the current audio output device in use by the client.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_current_output_device(callback)
Argument Type Description
callback Function The callback function to trigger on completion.

Returns:

N/A


Triggers:

Callback

This is triggered when the request completes.

Key Type Description
device DiscordAudioDevice Struct holding information on the output device.


Back To Top

discord_social_client_get_input_devices

Discord Function: discordpp::Client::GetInputDevices()

This function asynchronously fetches the list of audio input devices available to the user.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_input_devices(callback)
Argument Type Description
callback Function The callback function to trigger on completion.

Returns:

N/A


Triggers:

Callback

This is triggered when the request completes.

Key Type Description
devices Array of DiscordAudioDevice An array holding structs with information on each input device.


Back To Top

discord_social_client_get_input_volume

Discord Function: discordpp::Client::GetInputVolume()

This function returns the input volume for the current user's microphone.

Input volume is specified as a percentage in the range [0, 100] which represents the perceptual loudness.


Syntax:

discord_social_client_get_input_volume()

Returns:

Real



Back To Top

discord_social_client_get_output_devices

Discord Function: discordpp::Client::GetOutputDevices()

This function asynchronously fetches the list of audio output devices available to the user.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_output_devices(callback)
Argument Type Description
callback Function The callback function to trigger on completion.

Returns:

N/A


Triggers:

Callback

This is triggered when the request completes.

Key Type Description
devices Array of DiscordAudioDevice An array holding structs with information on each output device.


Back To Top

discord_social_client_get_output_volume

Discord Function: discordpp::Client::GetOutputVolume()

This function returns the output volume for the current user.

Output volume is specified as a percentage in the range [0, 200] which represents the perceptual loudness.


Syntax:

discord_social_client_get_output_volume()

Returns:

Real



Back To Top

discord_social_client_get_self_deaf_all

Discord Function: discordpp::Client::GetSelfDeafAll()

This function returns whether the current user is deafened in all calls.


Syntax:

discord_social_client_get_self_deaf_all()

Returns:

Boolean



Back To Top

discord_social_client_get_self_mute_all

Discord Function: discordpp::Client::GetSelfMuteAll()

This function returns whether the current user's microphone is muted in all calls.


Syntax:

discord_social_client_get_self_mute_all()

Returns:

Boolean



Back To Top

discord_social_client_set_automatic_gain_control

Discord Function: discordpp::Client::SetAutomaticGainControl()

When enabled, automatically adjusts the microphone volume to keep it clear and consistent.

Defaults to on.

Generally this shouldn't need to be used unless you are building a voice settings UI for the user to control, similar to Discord's voice settings.


Syntax:

discord_social_client_set_automatic_gain_control(on)
Argument Type Description
on Boolean Whether to enable or not.

Returns:

N/A



Back To Top

discord_social_client_set_device_change_callback

Discord Function: discordpp::Client::SetDeviceChangeCallback()

This function sets a callback function to be invoked when Discord detects a change in the available audio devices.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_device_change_callback(callback)
Argument Type Description
callback Function The function to use.

Returns:

N/A


Triggers:

Callback

Called on device change.

Key Type Description
input_devices Array of DiscordAudioDevice An array containing the updated list of input devices.
output_devices Array of DiscordAudioDevice An array containing the updated list of output devices.


Back To Top

discord_social_client_set_echo_cancellation

Discord Function: discordpp::Client::SetEchoCancellation()

This function enables or disables the basic echo cancellation provided by the WebRTC library.

Defaults to on.

Generally this shouldn't need to be used unless you are building a voice settings UI for the user to control, similar to Discord's voice settings.


Syntax:

discord_social_client_set_echo_cancellation(on)
Argument Type Description
on Boolean Whether to enable or not.

Returns:

N/A



Back To Top

discord_social_client_set_input_device

Discord Function: discordpp::Client::SetInputDevice()

This function asynchronously changes the audio input device in use by the client to the specified device. You can find the list of device IDs that can be passed in with the discord_social_client_get_input_devices function.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_input_device(device_id, callback)
Argument Type Description
device_id String The device ID (see DiscordAudioDevice).
callback Function The function to trigger on completion.

Returns:

N/A


Triggers:

Callback

Called on setting the audio input device.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_set_input_volume

Discord Function: discordpp::Client::SetInputVolume()

This function sets the microphone volume for the current user.

Input volume is specified as a percentage in the range [0, 100] which represents the perceptual loudness.


Syntax:

discord_social_client_set_input_volume(vol)
Argument Type Description
vol Real The new microphone volume.

Returns:

N/A



Back To Top

discord_social_client_set_no_audio_input_callback

Discord Function: discordpp::Client::SetNoAudioInputCallback()

This function sets the callback function invoked when an audio input threshold is set and there is a change in whether audio is being detected.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_no_audio_input_callback(callback)
Argument Type Description
callback Function The callback function to trigger on completion.

Returns:

N/A


Triggers:

Callback

Called on changes in audio being detected.

Key Type Description
input_detected Boolean Whether input was detected.


Back To Top

discord_social_client_set_no_audio_input_threshold

Discord Function: discordpp::Client::SetNoAudioInputThreshold()

Threshold that can be set to indicate when no audio is being received by the user's mic.

An example of when this may be useful: When push to talk is being used and the user pushes their talk key, but something is configured wrong and no audio is being received, this threshold and callback can be used to detect that situation and notify the user. The threshold is specified in DBFS, or decibels relative to full scale, and the range is [-100.0, 100.0] It defaults to -100.0, so is disabled.


Syntax:

discord_social_client_set_no_audio_input_threshold(threshold)
Argument Type Description
threshold Real The threshold value to use.

Returns:

N/A



Back To Top

discord_social_client_set_noise_suppression

Discord Function: discordpp::Client::SetNoiseSuppression()

This function enables basic background noise suppression.

Defaults to on.

Generally this shouldn't need to be used unless you are building a voice settings UI for the user to control, similar to Discord's voice settings.


Syntax:

discord_social_client_set_noise_suppression(on)
Argument Type Description
on Boolean Whether to enable or not.

Returns:

N/A



Back To Top

discord_social_client_set_opus_hardware_coding

Discord Function: discordpp::Client::SetOpusHardwareCoding()

This function enables or disables hardware encoding and decoding for audio, if it is available.

Defaults to on.

This must be called immediately after constructing the Client. If called too late an error will be logged and the setting will not take effect.


Syntax:

discord_social_client_set_opus_hardware_coding(encode, decode)
Argument Type Description
encode Boolean Whether to enable encoding or not.
decode Boolean Whether to enable decoding or not.

Returns:

N/A



Back To Top

discord_social_client_set_output_device

Discord Function: discordpp::Client::SetOutputDevice()

This function asynchronously changes the audio output device in use by the client to the specified device. You can find the list of device IDs that can be passed in with the discord_social_client_get_output_devices function.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_output_device(device_id, callback)
Argument Type Description
device_id String The device ID (see DiscordAudioDevice).
callback Function The function to trigger on completion.

Returns:

N/A


Triggers:

Callback

Called on setting the audio input device.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_set_output_volume

Discord Function: discordpp::Client::SetOutputVolume()

This function sets the speaker volume for the current user.

Output volume is specified as a percentage in the range [0, 200] which represents the perceptual loudness.


Syntax:

discord_social_client_set_output_volume(vol)
Argument Type Description
vol Real The output volume to use.

Returns:

N/A



Back To Top

discord_social_client_set_self_deaf_all

Discord Function: discordpp::Client::SetSelfDeafAll()

This function mutes all audio from the currently active call for the current user in all calls. They will not be able to hear any other participants, and no other participants will be able to hear the current user either.

Note

This overrides the per-call setting.


Syntax:

discord_social_client_set_self_deaf_all(deaf)
Argument Type Description
deaf Boolean Whether to mute or not.

Returns:

N/A



Back To Top

discord_social_client_set_self_mute_all

Discord Function: discordpp::Client::SetSelfMuteAll()

This function mutes the current user's microphone so that no other participant in their active calls can hear them in all calls.

Note

This overrides the per-call setting.


Syntax:

discord_social_client_set_self_mute_all(mute)
Argument Type Description
mute Boolean Whether to mute or not.

Returns:

N/A



Back To Top

discord_social_client_set_thread_priority

Discord Function: discordpp::Client::SetThreadPriority()

This function allows setting the priority of various SDK threads.

The threads that can be controlled are:

  • Client: This is the main thread for the SDK where most of the data processing happens.
  • Network: This is the thread that receives voice data from lobby calls.
  • Voice: This is the thread that the voice engine runs on and processes all audio data.

Syntax:

discord_social_client_set_thread_priority(thread, priority)
Argument Type Description
thread DiscordClientThread The type of thread to set thread priority on.
priority Real The thread priority.

Returns:

N/A



Back To Top

discord_social_client_set_voice_participant_changed_callback

Discord Function: discordpp::Client::SetVoiceParticipantChangedCallback()

This function sets the callback invoked whenever a user in a lobby joins or leaves a voice call.

The main use case for this is to enable displaying which users are in voice in a lobby even if the current user is not in voice yet, and thus does not have a Call object to bind to.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_voice_participant_changed_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered on change of participants in a voice call:

Key Type Description
lobby_id Real The ID of the lobby.
member_id Real The ID of the member.
added Boolean Whether the member was added or not.


Back To Top

discord_social_client_show_audio_route_picker

Discord Function: discordpp::Client::ShowAudioRoutePicker()

On iOS devices, show the system audio route picker.


Syntax:

discord_social_client_show_audio_route_picker()

Returns:

Boolean



Back To Top

discord_social_client_start_call

Discord Function: discordpp::Client::StartCall()

This function starts or joins a call in the lobby specified by channel_id (For a lobby, simply pass in the lobby_id).

On iOS, your application is responsible for enabling the appropriate background audio mode in your Info.plist.

On macOS, you should set the NSMicrophoneUsageDescription key in your Info.plist.

Returns undefined if the user is already in the given voice channel.


Syntax:

discord_social_client_start_call(channel_id)
Argument Type Description
channel_id Real The channel ID.

Returns:

DiscordCall



Back To Top

discord_social_client_start_call_with_audio_callbacks

Discord Function: discordpp::Client::StartCallWithAudioCallbacks()

This function starts or joins a call in the specified lobby.

The audio received callback is invoked whenever incoming audio is received in a call. If you call discord_social_call_audio_should_mute to set outShouldMute to true during the callback, the audio data will be muted after the callback is invoked, which is useful if you're utilizing the incoming audio and playing it through your own audio engine or playback.

The audio captured callback is invoked whenever local audio is captured before it is processed and transmitted which may be useful for voice moderation, etc.

On iOS, your application is responsible for enabling the appropriate background audio mode in your Info.plist.

On macOS, you should set the NSMicrophoneUsageDescription key in your Info.plist.

Returns undefined if the user is already in the given voice channel.

Note

To fetch the audio data the extension provides the functions discord_social_call_fetch_received_data and discord_social_call_fetch_captured_data.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_start_call_with_audio_callbacks(lobby_id, received_callback, captured_callback)
Argument Type Description
lobby_id Real The lobby ID.
received_callback Function The audio received callback.
captured_callback Function The audio captured callback.

Returns:

DiscordCall


Triggers:

Callback

Discord Callback: UserAudioReceivedCallback

This callback is triggered when incoming audio is received.

The callback is called per user per lobby.

Note

Call discord_social_call_fetch_received_data to get the audio data.

Key Type Description
lobby_id Real The lobby ID.
user_id Real The user ID.
samples_per_channel Real The number of samples per channel.
sample_rate Real The sample rate.
channels Real The number of channels.

Callback

Discord Callback: UserAudioCapturedCallback

This callback is triggered when local audio is captured.

The callback is called per lobby.

Note

Call discord_social_call_fetch_captured_data to get the audio data.

Key Type Description
lobby_id Real The lobby ID.
samples_per_channel Real The number of samples per channel.
sample_rate Real The sample rate.
channels Real The number of channels.


Back To Top

discord_social_client_abort_authorize

Discord Function: discordpp::Client::AbortAuthorize()

This function will abort the authorize flow if it is in progress and tear down any associated state.

Note

This will not close authorization windows presented to the user.


Syntax:

discord_social_client_abort_authorize()

Returns:

N/A



Back To Top

discord_social_client_abort_get_token_from_device

Discord Function: discordpp::Client::AbortGetTokenFromDevice()

This function is used to abort/cleanup the device authorization flow.


Syntax:

discord_social_client_abort_get_token_from_device()

Returns:

N/A



Back To Top

discord_social_client_authorize

Discord Function: discordpp::Client::Authorize()

This function initiates an OAuth2 flow for a user to "sign in with Discord". This flow is intended for desktop and mobile devices. If you are implementing for the console, leverage the device auth flow instead (discord_social_client_get_token_from_device or discord_social_client_open_authorize_device_screen).

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_authorize(args, callback)
Argument Type Description
args DiscordAuthorizationArgs Arguments to use for the authorization.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered upon completion of the request.

Key Type Description
result DiscordClientResult The result of the request.
code String The authorisation code.
redirect_uri String The redirect URI.


Back To Top

discord_social_client_close_authorize_device_screen

Discord Function: discordpp::Client::CloseAuthorizeDeviceScreen()

This function is used to hide the device authorization screen and is used for the case where the user is on a limited input device, such as a console or smart TV. This function should be used in conjunction with a backend server to handle the device authorization flow. For a public client, you can use discord_social_client_abort_get_token_from_device instead.


Syntax:

discord_social_client_close_authorize_device_screen()

Returns:

N/A



Back To Top

discord_social_client_get_provisional_token

Discord Function: discordpp::Client::GetProvisionalToken()

This function generates a Discord access token. You pass in the "identity" of the user, and it generates a new Discord account that is tied to that identity. There are multiple ways of specifying that identity, including using Steam/Epic services, or using your own identity system.

The callback function will be invoked with an access token that expires in 1 hour. Refresh tokens are not supported for provisional accounts, so that will be an empty string. You will need to call this function again to get a new access token when the old one expires.

Provisional accounts are a way for users that have not signed up for Discord to still access SDK functionality. They are "placeholder" Discord accounts for the user that are owned and managed by your game. Provisional accounts exist so that your users can engage with Discord APIs and systems without the friction of creating their own Discord account. Provisional accounts and their data are unique per Discord application.

See the Discord function documentation for more information.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_provisional_token(application_id, token_type, token, callback)
Argument Type Description
application_id Real The application ID.
token_type DiscordAuthenticationExternalAuthType The token type.
token String The token.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered upon completion of the request.

Key Type Description
result DiscordClientResult The result of the request.
access_token String The access token.
refresh_token String The refresh token.
token_type DiscordAuthorizationTokenType The type of token.
expires_in Real The time left till expiry of the token.
scopes String The scopes.


Back To Top

discord_social_client_get_token

Discord Function: discordpp::Client::GetToken()

This function exchanges an authorization code that was returned from the discord_social_client_authorize callback function for an access token which can be used to authenticate with the SDK.

Note

The code verifier is returned by discord_social_client_authorize.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_token(application_id, code, code_verifier, redirect_uri, callback)
Argument Type Description
application_id Real The application ID.
code String The authorisation code.
code_verifier String The code verifier.
redirect_uri String The redirect URI.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered upon completion of the request.

Key Type Description
result DiscordClientResult The result of the request.
access_token String The access token.
refresh_token String The refresh token.
token_type DiscordAuthorizationTokenType The type of token.
expires_in Real The time left till expiry of the token.
scopes String The scopes.


Back To Top

discord_social_client_get_token_from_device

Discord Function: discordpp::Client::GetTokenFromDevice()

This function is a combination of discord_social_client_authorize Client::Authorize and discord_social_client_get_token, but is used for the case where the user is on a limited input device, such as a console or smart TV.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_token_from_device(client_id, scopes, callback)
Argument Type Description
client_id Real The client ID.
scopes String A space separated string of the OAuth scopes your game is requesting.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered upon completion of the request.

Key Type Description
result DiscordClientResult The result of the request.
access_token String The access token.
refresh_token String The refresh token.
token_type DiscordAuthorizationTokenType The type of token.
expires_in Real The time left till expiry of the token.
scopes String The scopes.


Back To Top

discord_social_client_get_token_from_device_provisional_merge

Discord Function: discordpp::Client::GetTokenFromDeviceProvisionalMerge()

This function is a combination of discord_social_client_authorize and discord_social_client_get_token_from_provisional_merge, but is used for the case where the user is on a limited input device, such as a console or smart TV.

This function should be used whenever a user with a provisional account wants to link to an existing Discord account or "upgrade" their provisional account into a "full" Discord account.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_token_from_device_provisional_merge(client_id, scopes, external_auth_type, external_auth_token, callback)
Argument Type Description
client_id Real The client ID.
scopes String A space separated string of the OAuth scopes your game is requesting.
external_auth_type DiscordAuthenticationExternalAuthType The external authentication type.
external_auth_token String The external auth token.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered upon completion of the request.

Key Type Description
result DiscordClientResult The result of the request.
access_token String The access token.
refresh_token String The refresh token.
token_type DiscordAuthorizationTokenType The type of token.
expires_in Real The time left till expiry of the token.
scopes String The scopes.


Back To Top

discord_social_client_get_token_from_provisional_merge

Discord Function: discordpp::Client::GetTokenFromProvisionalMerge()

This function should be used with the discord_social_client_authorize function whenever a user with a provisional account wants to link to an existing Discord account or "upgrade" their provisional account into a "full" Discord account.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_token_from_provisional_merge(application_id, code, code_verifier, redirect_uri, external_auth_type, external_auth_token, callback)
Argument Type Description
application_id Real The application ID.
code String The code.
code_verifier String The code verifier.
redirect_uri String The redirect URI.
external_auth_type DiscordAuthenticationExternalAuthType The type of external authentication.
external_auth_token String The external auth token.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered upon completion of the request.

Key Type Description
result DiscordClientResult The result of the request.
access_token String The access token.
refresh_token String The refresh token.
token_type DiscordAuthorizationTokenType The type of token.
expires_in Real The time left till expiry of the token.
scopes String The scopes.


Back To Top

discord_social_client_is_authenticated

Discord Function: discordpp::Client::IsAuthenticated()

This function returns true if the SDK has a non-empty OAuth2 token set, regardless of whether that token is valid or not.


Syntax:

discord_social_client_is_authenticated()

Returns:

Boolean



Back To Top

discord_social_client_open_authorize_device_screen

Discord Function: discordpp::Client::OpenAuthorizeDeviceScreen()

This function is used to show the device authorization screen and is used for the case where the user is on a limited input device, such as a console or smart TV. This function should be used in conjunction with a backend server to handle the device authorization flow. For a public client, you can use discord_social_client_get_token_from_device instead.


Syntax:

discord_social_client_open_authorize_device_screen(client_id, user_code)
Argument Type Description
client_id Real The client ID.
user_code String The user code.

Returns:

N/A



Back To Top

discord_social_client_provisional_user_merge_completed

Discord Function: discordpp::Client::ProvisionalUserMergeCompleted()

Some functions don't work for provisional accounts, and require the user merge their account into a full Discord account before proceeding. This callback is invoked when an account merge must take place before proceeding. The developer is responsible for initiating the account merge, and then calling this function to signal to the SDK that the pending operation can continue with the new account.


Syntax:

discord_social_client_provisional_user_merge_completed(success)
Argument Type Description
success Boolean Whether merge was successful.

Returns:

N/A



Back To Top

discord_social_client_refresh_token

Discord Function: discordpp::Client::RefreshToken()

This function generates a new access token for the current user from a refresh token.

Once this is called, the old access and refresh tokens are both invalidated and cannot be used again. The callback function will be invoked with a new access and refresh token. See discord_social_client_get_token for more details.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_refresh_token(application_id, refresh_token, callback)
Argument Type Description
application_id Real The application ID.
refresh_token String The refresh token.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered upon completion of the request.

Key Type Description
result DiscordClientResult The result of the request.
access_token String The access token.
refresh_token String The refresh token.
token_type DiscordAuthorizationTokenType The type of token.
expires_in Real The time left till expiry of the token.
scopes String The scopes.


Back To Top

discord_social_client_set_authorize_device_screen_closed_callback

Discord Function: discordpp::Client::SetAuthorizeDeviceScreenClosedCallback()

This function sets a callback function to be invoked when the device authorization screen is closed.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_authorize_device_screen_closed_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

This is triggered when the device authorization screen is closed.



Back To Top

discord_social_client_set_game_window_pid

Discord Function: discordpp::Client::SetGameWindowPid()

When users are linking their account with Discord, which involves an OAuth2 flow, the SDK can streamline it by using Discord's overlay so the interaction happens entirely in-game. If your game's main window is not the same process as the one running the integration you may need to set the window PID using this method. It defaults to the current pid.


Syntax:

discord_social_client_set_game_window_pid(pid)
Argument Type Description
pid Real The process ID to set.

Returns:

N/A



Back To Top

discord_social_client_set_token_expiration_callback

Discord Function: discordpp::Client::SetTokenExpirationCallback()

This function sets the callback function through which to get a notification when the current token is about to expire or expired.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_token_expiration_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

This is triggered when the token expires.



Back To Top

discord_social_client_update_provisional_account_display_name

Discord Function: discordpp::Client::UpdateProvisionalAccountDisplayName()

This function updates the display name of a provisional account to the specified name.

This should generally be invoked whenever the SDK starts and whenever a provisional account changes their name, since the auto-generated name for provisional accounts is just a random string.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_update_provisional_account_display_name(name, callback)
Argument Type Description
name String The new display name to use.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

This is triggered when the display name changes.

Key Type Description
result DiscordClientResult The result code.


Back To Top

discord_social_client_update_token

Discord Function: discordpp::Client::UpdateToken()

This function asynchronously sets a new auth token for this client to use.

If the client is already connected, this function may trigger a reconnect. If the client is not connected, this function will only update the auth token, and so you must invoke discord_social_client_connect as well. You should wait for the given callback function to be invoked though so that the next discord_social_client_connect attempt uses the updated token.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_update_token(token_type, token, callback)
Argument Type Description
token_type DiscordAuthorizationTokenType The token type.
token String The token.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

This is triggered when the token has been updated.

Key Type Description
result DiscordClientResult The result code.


Back To Top

discord_social_client_can_open_message_in_discord

Discord Function: discordpp::Client::CanOpenMessageInDiscord()

This function returns true if the given message is able to be viewed in a Discord client.

Not all chat messages are replicated to Discord. For example lobby chat and some DMs are ephemeral and not persisted on Discord so cannot be opened. This function checks those conditions and makes sure the message is viewable in Discord.


Syntax:

discord_social_client_can_open_message_in_discord(message_id)
Argument Type Description
message_id Real The message ID.

Returns:

Boolean



Back To Top

discord_social_client_delete_user_message

Discord Function: discordpp::Client::DeleteUserMessage()

This function deletes the specified message sent by the current user to the specified recipient.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_delete_user_message(recipient_id, message_id, callback)
Argument Type Description
recipient_id Real The recipient ID.
message_id Real The message ID.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

This is triggered after deletion.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_get_channel_handle

Discord Function: discordpp::Client::GetChannelHandle()

This function returns a reference to the Discord channel object for the given ID.

All messages in Discord are sent in a channel, so the most common use for this will be to look up the channel a message was sent in. For convenience this API will also work with lobbies, so the three possible return values for the SDK are a DM, an Ephemeral DM, and a Lobby.


Syntax:

discord_social_client_get_channel_handle(channel_id)
Argument Type Description
channel_id Real The channel ID.

Returns:

DiscordChannelHandle



Back To Top

discord_social_client_get_message_handle

Discord Function: discordpp::Client::GetMessageHandle()

This function returns a reference to the Discord message object for the given ID.

The SDK keeps the 25 most recent messages in each channel in memory. Messages sent before the SDK was started cannot be accessed with this.


Syntax:

discord_social_client_get_message_handle(message_id)
Argument Type Description
message_id Real The message ID.

Returns:

DiscordMessageHandle



Back To Top

discord_social_client_open_message_in_discord

Discord Function: discordpp::Client::OpenMessageInDiscord()

This function opens the given message in the Discord client.

This is useful when a message is sent that contains content that cannot be viewed in Discord. You can call this function in the click handler for any CTA you show to view the message in Discord.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_open_message_in_discord(message_id, provisional_user_merge_required_callback, open_message_in_discord_callback)
Argument Type Description
message_id Real The message ID.
provisional_user_merge_required_callback Function The callback to trigger when provisional user merge is required.
open_message_in_discord_callback Function The callback to trigger when the message has been opened.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.

Callback

Triggered when provisional user merge is required.



Back To Top

discord_social_client_send_lobby_message

Discord Function: discordpp::Client::SendLobbyMessage()

This function sends a message in a lobby chat to all members of the lobby.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_lobby_message(lobby_id, content, callback)
Argument Type Description
lobby_id Real The lobby ID.
content String The message content.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered after the message has been sent.

Key Type Description
result DiscordClientResult The result.
message_id Real The message ID.


Back To Top

discord_social_client_send_lobby_message_with_metadata

Discord Function: discordpp::Client::SendLobbyMessageWithMetadata()

This function is a variant of discord_social_client_send_lobby_message that also accepts metadata to be sent with the message.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_lobby_message_with_metadata(lobby_id, content, metadata, callback)
Argument Type Description
lobby_id Real The lobby ID.
content String The message content.
metadata Struct The metadata.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered after the message has been sent.

Key Type Description
result DiscordClientResult The result.
message_id Real The message ID.


Back To Top

discord_social_client_send_user_message

Discord Function: discordpp::Client::SendUserMessage()

This function sends a direct message to the specified user.

A message can be sent between two users in the following situations:

  • Both users are online and in the game and have not blocked each other
  • Both users are friends with each other
  • Both users share a mutual Discord server and have previously DM'd each other on Discord

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_user_message(recipient_id, content, callback)
Argument Type Description
recipient_id Real The recipient ID.
content String The message content.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered after the message has been sent.

Key Type Description
result DiscordClientResult The result.
message_id Real The message ID.


Back To Top

discord_social_client_send_user_message_with_metadata

Discord Function: discordpp::Client::SendUserMessageWithMetadata()

This function is a variant of discord_social_client_send_user_message that also accepts metadata to be sent with the message.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_user_message_with_metadata(recipient_id, content, metadata, callback)
Argument Type Description
recipient_id Real The recipient ID.
content String The message content.
metadata Struct The metadata.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered after the message has been sent.

Key Type Description
result DiscordClientResult The result.
message_id Real The message ID.


Back To Top

discord_social_client_set_message_created_callback

Discord Function: discordpp::Client::SetMessageCreatedCallback()

This function sets the callback function to be invoked whenever a new message is received in either a lobby or a DM.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_message_created_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered after a message has been received.

Key Type Description
message_id Real The message ID.


Back To Top

discord_social_client_set_message_deleted_callback

Discord Function: discordpp::Client::SetMessageDeletedCallback()

This function sets the callback function to be invoked whenever a message is deleted.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_message_deleted_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered after a message has been deleted.

Key Type Description
message_id Real The message ID.
channel_id Real The channel ID.


Back To Top

discord_social_client_set_message_updated_callback

Discord Function: discordpp::Client::SetMessageUpdatedCallback()

This function sets the callback function to be invoked whenever a message is edited.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_message_updated_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered after a message has been updated.

Key Type Description
message_id Real The message ID.


Back To Top

discord_social_client_set_showing_chat

Discord Function: discordpp::Client::SetShowingChat()

This function sets whether chat messages are currently being shown in the game.


Syntax:

discord_social_client_set_showing_chat(showing_chat)
Argument Type Description
showing_chat Boolean Whether chat messages are being shown or not.

Returns:

N/A



Back To Top

discord_social_client_add_log_callback

Discord Function: discordpp::Client::AddLogCallback()

This function adds a callback function to be invoked for each new log message generated by the SDK.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_add_log_callback(min_severity, callback)
Argument Type Description
min_severity DiscordLoggingSeverity The minimum severity.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered when a new log message is generated.

Key Type Description
message String The log message.
severity DiscordLoggingSeverity The logging severity.


Back To Top

discord_social_client_add_voice_log_callback

Discord Function: discordpp::Client::AddVoiceLogCallback()

Adds a callback function to be invoked for each new log message generated by the voice subsystem of the SDK, including the underlying webrtc infrastructure.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_add_voice_log_callback(min_severity, callback)
Argument Type Description
min_severity DiscordLoggingSeverity The minimum severity.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered when a new log message is generated.

Key Type Description
message String The log message.
severity DiscordLoggingSeverity The logging severity.


Back To Top

discord_social_client_connect

Discord Function: discordpp::Client::Connect()

This function asynchronously connects the client to Discord.

If a client is disconnecting, this will wait for the disconnect before reconnecting. You should use the discord_social_client_set_status_changed_callback and discord_social_client_get_status functions to receive updates on the client status. The Client is only safe to use once the status changes to DiscordClientStatus.Ready.


Syntax:

discord_social_client_connect()

Returns:

N/A



Back To Top

discord_social_client_disconnect

Discord Function: discordpp::Client::Disconnect()

This function asynchronously disconnects the client.

You can leverage discord_social_client_set_status_changed_callback and discord_social_client_get_status to receive updates on the client status. It is fully disconnected when the status changes to DiscordClientStatus.Disconnected.


Syntax:

discord_social_client_disconnect()

Returns:

N/A



Back To Top

discord_social_client_get_status

Discord Function: discordpp::Client::GetStatus()

This function returns the current status of the client, see the DiscordClientStatus enum for an explanation of the possible values.


Syntax:

discord_social_client_get_status()

Returns:

DiscordClientStatus



Back To Top

discord_social_client_set_log_dir

Discord Function: discordpp::Client::SetLogDir()

This function causes logs generated by the SDK to be written to disk in the specified directory.

This function explicitly excludes most logs for voice and webrtc activity since those are generally much noisier and you may want to pick a different log level for those. So it will instead include logs for things such as lobbies, relationships, presence, and authentication. An empty path defaults to logging alongside the client library. A min_severity = DiscordLoggingSeverity.None disables logging to a file (also the current default). The logs will be placed into a file called "discord.log" in the specified directory. Overwrites any existing discord.log file.

Returns true if the log file was successfully opened, false otherwise.


Syntax:

discord_social_client_set_log_dir(path, min_severity)
Argument Type Description
path String The path to the log directory.
min_severity DiscordLoggingSeverity The minimum severity.

Returns:

Boolean



Back To Top

discord_social_client_set_status_changed_callback

Discord Function: discordpp::Client::SetStatusChangedCallback()

This function sets the callback function to be invoked whenever the SDK's status changes.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_status_changed_callback(callback)
Argument Type Description
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered when the SDK's status changes.

The error_detail will usually be one of the error codes described here:

https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes

Key Type Description
status DiscordClientStatus The status.
error DiscordClientError The error.
error_detail Real A detail code of the error.


Back To Top

discord_social_client_set_voice_log_dir

Discord Function: discordpp::Client::SetVoiceLogDir()

This function causes logs generated by the voice subsystem of the SDK to be written to disk in the specified directory.

These logs will be in a file like discord-webrtc_0, and if they grow to big will be rotated and the number incremented. If the log files already exist the old ones will be renamed to discord-last-webrtc_0.

An empty path defaults to logging alongside the client library. A min_severity = DiscordLoggingSeverity.None disables logging to a file (also the current default).

Warning

This function must be called immediately after constructing the Client object! It will print out a warning if invoked too late.


Syntax:

discord_social_client_set_voice_log_dir(path, min_severity)
Argument Type Description
path String The path to the voice log directory.
min_severity DiscordLoggingSeverity The minimum severity.

Returns:

N/A



Back To Top

discord_social_client_create_or_join_lobby

Discord Function: discordpp::Client::CreateOrJoinLobby()

This function joins the user to the specified lobby, creating one if it does not exist.

The lobby is specified by the supplied string, which should be a hard to guess secret generated by the game. All users who join the lobby with the same secret will be placed in the same lobby.

For exchanging the secret, it is strongly encouraged to look into the activity invite and rich presence systems which provide a way to include a secret string that only accepted party members are able to see.

As with server created lobbies, client created lobbies auto-delete once they have been idle for a few minutes (which currently defaults to 5 minutes). A lobby is idle if no users are connected to it.

This function shouldn't be used for long lived lobbies. The "secret" value expires after ~30 days, at which point the existing lobby cannot be joined and a new one would be created instead.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_create_or_join_lobby(secret, callback)
Argument Type Description
secret String The lobby secret.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when a lobby is created or joined.

Key Type Description
result DiscordClientResult The result.
lobby_id Real The lobby ID.


Back To Top

discord_social_client_create_or_join_lobby_with_metadata

Discord Function: discordpp::Client::CreateOrJoinLobbyWithMetadata()

This function is a variant of discord_social_client_create_or_join_lobby that also accepts developer-supplied metadata.

Metadata is just simple string key/value pairs. An example use case for this might be to the internal game ID of the user of each lobby so all members of the lobby can have a mapping of Discord IDs to game IDs. Subsequent calls to CreateOrJoinLobby will overwrite the metadata for the lobby and member.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_create_or_join_lobby_with_metadata(secret, lobby_metadata_struct, member_metadata_struct, callback)
Argument Type Description
secret String The lobby secret.
lobby_metadata_struct Struct A struct holding the lobby metadata.
member_metadata_struct Struct A struct holding the member metadata.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when a lobby is created or joined.

Key Type Description
result DiscordClientResult The result.
lobby_id Real The lobby ID.


Back To Top

discord_social_client_get_guild_channels

Discord Function: discordpp::Client::GetGuildChannels()

Fetches all of the channels that the current user can access in the given guild. Channels are sorted by their position field, which matches what you see in the Discord client.

The purpose of this is to power the channel linking flow for linking a Discord channel to an in-game lobby. So this function can be used to power a UI to let the user pick which channel to link to once they have picked a guild. See the docs on DiscordLobbyHandle for more information.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_guild_channels(guild_id, callback)
Argument Type Description
guild_id Real The guild ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when guild channels have been retrieved.

Key Type Description
result DiscordClientResult The result.
guild_channels Array of DiscordGuildChannel An array holding structs representing the guild channels.


Back To Top

discord_social_client_get_lobby_handle

Discord Function: discordpp::Client::GetLobbyHandle()

This function returns a reference to the Discord lobby object for the given ID.


Syntax:

discord_social_client_get_lobby_handle(lobby_id)
Argument Type Description
lobby_id Real The lobby ID.

Returns:

DiscordLobbyHandle



Back To Top

discord_social_client_get_lobby_ids

Discord Function: discordpp::Client::GetLobbyIds()

This function returns a list of all the lobbies that the user is a member of and the SDK has loaded.


Syntax:

discord_social_client_get_lobby_ids()

Returns:

Array of Real



Back To Top

discord_social_client_get_user_guilds

Discord Function: discordpp::Client::GetUserGuilds()

This function fetches all of the guilds (also known as Discord servers) that the current user is a member of.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_user_guilds(callback)
Argument Type Description
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered when complete.

Key Type Description
result DiscordClientResult The result.
guilds Array of DiscordGuildMinimal An array holding structs that represent the guilds the user is a member of.


Back To Top

discord_social_client_leave_lobby

Discord Function: discordpp::Client::LeaveLobby()

This function removes the current user from the specified lobby.

Only lobbies that contain a "secret" can be left. In other words, only lobbies created with discord_social_client_create_or_join_lobby can be left. Lobbies created using the server API may not be manipulated by clients, so you must use the server API to remove them too.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_leave_lobby(lobby_id, callback)
Argument Type Description
lobby_id Real The lobby ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_link_channel_to_lobby

Discord Function: discordpp::Client::LinkChannelToLobby()

This function links the specified channel on Discord to the specified in-game lobby.

Any message sent in one will be copied over to the other. See the docs on DiscordLobbyHandle for more information.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_link_channel_to_lobby(lobby_id, channel_id, callback)
Argument Type Description
lobby_id Real The lobby ID.
channel_id Real The channel ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_set_lobby_created_callback

Discord Function: discordpp::Client::SetLobbyCreatedCallback()

This function sets a callback to be invoked when a lobby "becomes available" to the client.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_lobby_created_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when a lobby becomes available.

Key Type Description
lobby_id Real The lobby ID.


Back To Top

discord_social_client_set_lobby_deleted_callback

Discord Function: discordpp::Client::SetLobbyDeletedCallback()

This function sets a callback to be invoked when a lobby is no longer available.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_lobby_deleted_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when a lobby is no longer available.

Key Type Description
lobby_id Real The lobby ID.


Back To Top

discord_social_client_set_lobby_member_added_callback

Discord Function: discordpp::Client::SetLobbyMemberAddedCallback()

This function sets a callback function to be invoked whenever a user is added to a lobby.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_lobby_member_added_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when a user is added to a lobby.

Key Type Description
lobby_id Real The lobby ID.
member_id Real The member ID.


Back To Top

discord_social_client_set_lobby_member_removed_callback

Discord Function: discordpp::Client::SetLobbyMemberRemovedCallback()

This function sets a callback function to be invoked whenever a member of a lobby is removed and can no longer connect to it.

This callback will not be invoked when the current user is removed from a lobby, instead LobbyDeleted callback will be invoked. Additionally this is not invoked when a user simply exits the game. That would cause the LobbyMemberUpdatedCallback to be invoked, and the DiscordLobbyMemberHandle struct will indicate they are not connected now.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_lobby_member_removed_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when a member of a lobby is removed.

Key Type Description
lobby_id Real The lobby ID.
member_id Real The member ID.


Back To Top

discord_social_client_set_lobby_member_updated_callback

Discord Function: discordpp::Client::SetLobbyMemberUpdatedCallback()

This function sets a callback function to be invoked whenever a member of a lobby is changed.

This is invoked when:

  • The user connects or disconnects
  • The metadata of the member is changed

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_lobby_member_updated_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when a member of a lobby is changed.

Key Type Description
lobby_id Real The lobby ID.
member_id Real The member ID.


Back To Top

discord_social_client_set_lobby_updated_callback

Discord Function: discordpp::Client::SetLobbyUpdatedCallback()

This function sets a callback to be invoked when a lobby is edited, for example if the lobby's metadata is changed.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_lobby_updated_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when a lobby is edited.

Key Type Description
lobby_id Real The lobby ID.


Back To Top

discord_social_client_unlink_channel_from_lobby

Discord Function: discordpp::Client::UnlinkChannelFromLobby()

This function removes any existing channel link from the specified lobby.

See the docs on LobbyHandle for more information. A lobby can be unlinked by any user with the LobbyMemberFlags::CanLinkLobby flag (DiscordLobbyMemberHandle.can_link_lobby set to true), they do not need to have any permissions on the Discord channel in order to sever the in-game link.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_unlink_channel_from_lobby(lobby_id, callback)
Argument Type Description
lobby_id Real The lobby ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when a channel was unlinked from a lobby.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_accept_activity_invite

Discord Function: discordpp::Client::AcceptActivityInvite()

This function accepts an activity invite that the current user has received.

The given callback will be invoked with the join secret for the activity, which can be used to join the user to the game's internal party system for example. This join secret comes from the other user's rich presence activity.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_accept_activity_invite(activity_invite, callback)
Argument Type Description
activity_invite DiscordActivityInvite The activity invite.
callback Function The callback function to be called.

Returns:

N/A


Triggers:

Callback

Triggered on accept.

Key Type Description
result DiscordClientResult The result.
join_secret String The join secret.


Back To Top

discord_social_client_clear_rich_presence

Discord Function: discordpp::Client::ClearRichPresence()

This function clears the rich presence for the current user.


Syntax:

discord_social_client_clear_rich_presence()

Returns:

N/A



Back To Top

discord_social_client_register_launch_command

Discord Function: discordpp::Client::RegisterLaunchCommand()

When a user accepts an activity invite for your game within the Discord client, Discord needs to know how to launch the game for that user. This function allows you to register a command that Discord will run to launch your game. You should invoke this when the SDK starts up so that if the user in the future tries to join from Discord the game will be able to be launched for them. Returns true if the command was successfully registered, false otherwise.

On Windows and Linux, this command should be a path to an executable. It also supports any launch parameters that may be needed, like "C:\path\to my\game.exe" –full-screen –no-hax If you pass an empty string in for the command, the SDK will register the current running executable. To launch the game from a custom protocol like my-awesome-game://, pass that in as an argument of the executable that should be launched by that protocol. For example, "C:\path\to my\game.exe" my-awesome-game://.

On macOS, due to the way Discord registers executables, your game needs to be bundled for this command to work. That means it should be a .app. You can pass a custom protocol like my-awesome-game:// as the custom command, but not a path to an executable. If you pass an empty string in for the command, the SDK will register the current running bundle, if any.


Syntax:

discord_social_client_register_launch_command(application_id, command)
Argument Type Description
application_id Real The application ID.
command String The command.

Returns:

Boolean



Back To Top

discord_social_client_register_launch_steam_application

Discord Function: discordpp::Client::RegisterLaunchSteamApplication()

When a user accepts an activity invite for your game within the Discord client, Discord needs to know how to launch the game for that user. For Steam games, this function allows you to indicate to Discord what the Steam game ID is. You should invoke this when the SDK starts up so that if the user in the future tries to join from Discord the game will be able to be launched for them. Returns true if the command was successfully registered, false otherwise.


Syntax:

discord_social_client_register_launch_steam_application(application_id, steam_app_id)
Argument Type Description
application_id Real The application ID.
steam_app_id Real The Steam app ID.

Returns:

Boolean



Back To Top

discord_social_client_send_activity_invite

Discord Function: discordpp::Client::SendActivityInvite()

This function sends a Discord activity invite to the specified user.

The invite is sent as a message on Discord, which means it can be sent if any of the following are true:

  • Both users are online and in the game and have not blocked each other
  • Both users are friends with each other
  • Both users share a mutual Discord server and have previously DM'd each other on Discord

You can optionally include some message content to include in the message containing the invite, but it's ok to pass an empty string too.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_activity_invite(user_id, content, callback)
Argument Type Description
user_id Real The user ID to send the invite to.
content String The invite's content.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_send_activity_join_request

Discord Function: discordpp::Client::SendActivityJoinRequest()

This function requests to join the activity of the specified user.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_activity_join_request(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_send_activity_join_request_reply

Discord Function: discordpp::Client::SendActivityJoinRequestReply()

When another user requests to join the current user's party, this function is called to to allow that user to join. Specifically this will send the original user an activity invite which they then need to accept again.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_activity_join_request_reply(activity_invite, callback)
Argument Type Description
activity_invite DiscordActivityInvite The activity invite.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_set_activity_invite_created_callback

Discord Function: discordpp::Client::SetActivityInviteCreatedCallback()

This function sets a callback function that is invoked when the current user receives an activity invite from another user.

These invites are always sent as messages, so the SDK is parsing these messages to look for invites and invokes this callback instead. The message create callback will not be invoked for these messages. The invite object contains all the necessary information to identity the invite, which you can later pass to discord_social_client_accept_activity_invite.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_activity_invite_created_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when the current user receives an activity invite.

Key Type Description
invite DiscordActivityInvite The activity invite.


Back To Top

discord_social_client_set_activity_invite_updated_callback

Discord Function: discordpp::Client::SetActivityInviteUpdatedCallback()

This function sets a callback function that is invoked when an existing activity invite changes. Currently, the only thing that changes on an activity invite is its validity. If the sender goes offline or exits the party the receiver was invited to, the invite is no longer joinable. It is possible for an invalid invite to go from invalid to valid if the sender rejoins the activity.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_activity_invite_updated_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when an existing activity invite changes.

Key Type Description
invite DiscordActivityInvite The activity invite.


Back To Top

discord_social_client_set_activity_join_callback

Discord Function: discordpp::Client::SetActivityJoinCallback()

This function sets a callback function that is invoked when the current user also has Discord running on their computer and they accept an activity invite in the Discord client.

This callback is invoked with the join secret from the activity rich presence, which you can use to join them to the game's internal party system. See Activity for more information on invites.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_activity_join_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when an activity invite is accepted.

Key Type Description
secret String The join secret.


Back To Top

discord_social_client_set_online_status

Discord Function: discordpp::Client::SetOnlineStatus()

This function sets whether a user is online/invisible/idle/dnd on Discord.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_online_status(status, callback)
Argument Type Description
status DiscordClientStatus The client status.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_update_rich_presence

Discord Function: discordpp::Client::UpdateRichPresence()

This function updates the rich presence for the current user.

You should use rich presence so that other users on Discord know this user is playing a game and you can include some hints of what they are playing such as a character name or map name. Rich presence also enables Discord game invites to work too!

Note

On Desktop, rich presence can be set before calling discord_social_client_connect, but it will be cleared if the Client connects. When Client is not connected, this sets the rich presence in the current user's Discord client when available.

See the docs on the Activity struct for more details.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_update_rich_presence(activity, callback)
Argument Type Description
activity DiscordActivity The activity.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_accept_discord_friend_request

Discord Function: discordpp::Client::AcceptDiscordFriendRequest()

This function accepts an incoming Discord friend request from the target user.

Fails if the target user has not sent a Discord friend request to the current user, meaning that the Discord relationship type between the users must be DiscordRelationshipType.PendingIncoming.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_accept_discord_friend_request(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_accept_game_friend_request

Discord Function: discordpp::Client::AcceptGameFriendRequest()

This function accepts an incoming game friend request from the target user.

Fails if the target user has not sent a game friend request to the current user, meaning that the game relationship type between the users must be DiscordRelationshipType.PendingIncoming.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_accept_game_friend_request(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_block_user

Discord Function: discordpp::Client::BlockUser()

This function blocks the target user so that they cannot send the user friend or activity invites and cannot message them anymore.

Blocking a user will also remove any existing relationship between the two users, and persists across games, so blocking a user in one game or on Discord will block them in all other games and on Discord as well.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_block_user(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_cancel_discord_friend_request

Discord Function: discordpp::Client::CancelDiscordFriendRequest()

This function cancels an outgoing Discord friend request to the target user.

Fails if a Discord friend request has not been sent to the target user, meaning that the Discord relationship type between the users must be DiscordRelationshipType.PendingOutgoing.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_cancel_discord_friend_request(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_cancel_game_friend_request

Discord Function: discordpp::Client::CancelGameFriendRequest()

This function cancels an outgoing game friend request to the target user.

Fails if a game friend request has not been sent to the target user, meaning that the game relationship type between the users must be DiscordRelationshipType.PendingOutgoing.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_cancel_game_friend_request(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_get_relationship_handle

Discord Function: discordpp::Client::GetRelationshipHandle()

This function returns the DiscordRelationshipHandle that corresponds to the relationship between the current user and the given user.


Syntax:

discord_social_client_get_relationship_handle(user_id)
Argument Type Description
user_id Real The user ID.

Returns:

DiscordRelationshipHandle



Back To Top

discord_social_client_get_relationships

Discord Function: discordpp::Client::GetRelationships()

This function returns a list of all of the relationships the current user has with others, including all Discord relationships and all Game relationships for the current game.


Syntax:

discord_social_client_get_relationships()

Returns:

Array of DiscordRelationshipHandle



Back To Top

discord_social_client_get_relationships_by_group

Discord Function: discordpp::Client::GetRelationshipsByGroup

This function returns a list of relationships that belong to the specified relationship group type. Relationships are logically partitioned into groups based on online status and game activity:

DiscordRelationshipGroupType.OnlinePlayingGame: Users who are online and currently playing the game DiscordRelationshipGroupType.OnlineElsewhere: Users who are online but not playing the game (users who have played the game before are sorted to the top) DiscordRelationshipGroupType.Offline: Users who are offline


Syntax:

discord_social_client_get_relationships_by_group(group_type)
Argument Type Description
group_type DiscordRelationshipGroupType The type of relationship group.

Returns:

Array of DiscordRelationshipHandle



Back To Top

discord_social_client_reject_discord_friend_request

Discord Function: discordpp::Client::RejectDiscordFriendRequest()

This function declines an incoming Discord friend request from the target user.

Fails if the target user has not sent a Discord friend request to the current user, meaning that the Discord relationship type between the users must be DiscordRelationshipType.PendingIncoming.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_reject_discord_friend_request(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_reject_game_friend_request

Discord Function: discordpp::Client::RejectGameFriendRequest()

This function declines an incoming Discord friend request from the target user.

Fails if the target user has not sent a Discord friend request to the current user, meaning that the Discord relationship type between the users must be DiscordRelationshipType.PendingIncoming.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_reject_game_friend_request(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_remove_discord_and_game_friend

Discord Function: discordpp::Client::RemoveDiscordAndGameFriend()

This function removes any friendship between the current user and the target user. This function will remove BOTH any Discord friendship and any game friendship between the users.

Fails if the target user is not currently a Discord OR game friend with the current user.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_remove_discord_and_game_friend(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_remove_game_friend

Discord Function: discordpp::Client::RemoveGameFriend()

This function removes any game friendship between the current user and the target user.

Fails if the target user is not currently a game friend with the current user.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_remove_game_friend(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_search_friends_by_username

Discord Function: discordpp::Client::SearchFriendsByUsername()

This function searches all of your friends by both username and display name, returning a list of all friends that match the search string.


Syntax:

discord_social_client_search_friends_by_username(search_str)
Argument Type Description
search_str String The string to search for.

Returns:

Array of DiscordUserHandle



Back To Top

discord_social_client_send_discord_friend_request

Discord Function: discordpp::Client::SendDiscordFriendRequest()

This function sends a Discord friend request to the target user.

The target user is identified by their Discord unique username (not their display name).

After the friend request is sent, each user will have a new Discord relationship created. For the current user the relationship type will be DiscordRelationshipType.PendingOutgoing and for the target user it will be DiscordRelationshipType.PendingIncoming.

If the current user already has received a Discord friend request from the target user (meaning relationship type is DiscordRelationshipType.PendingIncoming), then the two users will become Discord friends.

See RelationshipHandle for more information on the difference between Discord and Game relationships.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_discord_friend_request(username, callback)
Argument Type Description
username String The user name.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_send_discord_friend_request_by_id

Discord Function: discordpp::Client::SendDiscordFriendRequestById()

This function Sends a Discord friend request to the target user.

The target user is identified by their Discord ID.

After the friend request is sent, each user will have a new Discord relationship created. For the current user the relationship type will be DiscordRelationshipType.PendingOutgoing and for the target user it will be DiscordRelationshipType.PendingIncoming.

If the current user already has received a Discord friend request from the target user (meaning relationship type is DiscordRelationshipType.PendingIncoming), then the two users will become Discord friends.

See RelationshipHandle for more information on the difference between Discord and Game relationships.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_discord_friend_request_by_id(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_send_game_friend_request

Discord Function: discordpp::Client::SendGameFriendRequest()

This function sends (or accepts) a game friend request to the target user.

After the friend request is sent, each user will have a new game relationship created. For the current user the relationship type will be DiscordRelationshipType.PendingOutgoing and for the target user it will be DiscordRelationshipType.PendingIncoming.

If the current user already has received a game friend request from the target user (meaning relationship type is DiscordRelationshipType.PendingIncoming), then the two users will become game friends.

See RelationshipHandle for more information on the difference between Discord and Game relationships.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_game_friend_request(username, callback)
Argument Type Description
username String The user name.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_send_game_friend_request_by_id

Discord Function: discordpp::Client::SendGameFriendRequestById()

This function sends a game friend request to the target user.

The target user is identified by their Discord ID.

After the friend request is sent, each user will have a new game relationship created. For the current user the relationship type will be DiscordRelationshipType.PendingOutgoing and for the target user it will be DiscordRelationshipType.PendingIncoming.

If the current user already has received a game friend request from the target user (meaning relationship type is DiscordRelationshipType.PendingIncoming), then the two users will become game friends.

See RelationshipHandle for more information on the difference between Discord and Game relationships.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_send_game_friend_request_by_id(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_set_relationship_created_callback

Discord Function: discordpp::Client::SetRelationshipCreatedCallback()

This function sets a callback to be invoked whenever a relationship for this user is established or changes type.

This can be invoked when a user sends or accepts a friend invite or blocks a user for example.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_relationship_created_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when a relationship is created.

Key Type Description
user_id Real The user ID.
is_discord_relationship_update Boolean true if the relationship created with the user ID is a Discord relationship, and false if it's an in-game relationship.


Back To Top

discord_social_client_set_relationship_deleted_callback

Discord Function: discordpp::Client::SetRelationshipDeletedCallback()

This function sets a callback to be invoked whenever a relationship for this user is removed, such as when the user rejects a friend request or removes a friend.

When a relationship is removed, discord_social_client_get_relationship_handle will return a relationship with the type set to DiscordRelationshipType.None.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_relationship_deleted_callback(callback)
Argument Type Description
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when a relationship is deleted.

Key Type Description
user_id Real The user ID.
is_discord_relationship_update Boolean true if the relationship deleted with the user ID is a Discord relationship, and false if it's an in-game relationship.


Back To Top

discord_social_client_unblock_user

Discord Function: discordpp::Client::UnblockUser()

This function unblocks the target user. Does not restore any old relationship between the users though.

Fails if the target user is not currently blocked.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_unblock_user(user_id, callback)
Argument Type Description
user_id Real The user ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_get_current_user

Discord Function: discordpp::Client::GetCurrentUserV2()

This function returns the current user, or undefined when no user is authenticated or available.


Syntax:

discord_social_client_get_current_user()

Returns:

DiscordUserHandle



Back To Top

discord_social_client_get_discord_client_connected_user

Discord Function: discordpp::Client::GetDiscordClientConnectedUser()

If the Discord app is running on the user's computer and the SDK establishes a connection to it, this function will return the user that is currently logged in to the Discord app.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_discord_client_connected_user(application_id, callback)
Argument Type Description
application_id Real The application ID.
callback Function The callback function to call.

Returns:

N/A


Triggers:

Callback

Triggered when the function completes.

Key Type Description
result DiscordClientResult The result.


Back To Top

discord_social_client_get_user

Discord Function: discordpp::Client::GetUser()

This function returns the UserHandle associated with the given user ID.

It will not fetch a user from Discord's API if it is not available. Generally you can trust that users will be available for all relationships and for the authors of any messages received.


Syntax:

discord_social_client_get_user(user_id)
Argument Type Description
user_id Real the user ID.

Returns:

DiscordUserHandle



Back To Top

discord_social_client_set_user_updated_callback

Discord Function: discordpp::Client::SetUserUpdatedCallback()

The UserUpdatedCallback is invoked whenever any user the current session knows about changes, not just if the current user changes. For example if one of your Discord friends changes their name or avatar the UserUpdatedCallback will be invoked. It is also invoked when users come online, go offline, or start playing your game.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_user_updated_callback(callback)
Argument Type Description
callback Function The callback function to use.

Returns:

N/A


Triggers:

Callback

Triggered when a user changes.

Key Type Description
user_id Real The user ID.


Back To Top

discord_social_client_error_to_string

Discord Function: discordpp::Client::ErrorToString()

This function converts the DiscordClientError enum to a string.


Syntax:

discord_social_client_error_to_string(error)
Argument Type Description
error DiscordClientError The error value.

Returns:

String



Back To Top

discord_social_client_get_default_audio_device_id

Discord Function: discordpp::Client::GetDefaultAudioDeviceId()

This function returns the ID of the system default audio device if the user has not explicitly chosen one.


Syntax:

discord_social_client_get_default_audio_device_id()

Returns:

String



Back To Top

discord_social_client_get_default_communication_scopes

Discord Function: discordpp::Client::GetDefaultCommunicationScopes()

This function returns the default set of OAuth2 scopes that should be used with the Discord SDK when making use of the full SDK capabilities, including communications-related features (e.g. user DMs, lobbies, voice chat). If your application does not make use of these features, you should use discord_social_client_get_default_presence_scopes instead.


Syntax:

discord_social_client_get_default_communication_scopes()

Returns:

String



Back To Top

discord_social_client_get_default_presence_scopes

Discord Function: discordpp::Client::GetDefaultPresenceScopes()

This function returns the default set of OAuth2 scopes that should be used with the Discord SDK when leveraging baseline presence-related features (e.g. friends list, rich presence, provisional accounts, activity invites). If your application is using communications-related features, which are currently available in limited access, you should use discord_social_client_get_default_communication_scopes instead.


Syntax:

discord_social_client_get_default_presence_scopes()

Returns:

String



Back To Top

discord_social_client_get_version_hash

Discord Function: discordpp::Client::GetVersionHash()

This function returns the git commit hash this version was built from.


Syntax:

discord_social_client_get_version_hash()

Returns:

String



Back To Top

discord_social_client_get_version_major

Discord Function: discordpp::Client::GetVersionMajor()

This function returns the major version of the Discord Social SDK.


Syntax:

discord_social_client_get_version_major()

Returns:

Real



Back To Top

discord_social_client_get_version_minor

Discord Function: discordpp::Client::GetVersionMinor()

This function returns the minor version of the Discord Social SDK.


Syntax:

discord_social_client_get_version_minor()

Returns:

Real



Back To Top

discord_social_client_get_version_patch

Discord Function: discordpp::Client::GetVersionPatch()

This function returns the patch version of the Discord Social SDK.


Syntax:

discord_social_client_get_version_patch()

Returns:

Real



Back To Top

discord_social_client_status_to_string

Discord Function: discordpp::Client::StatusToString()

This function converts the Status enum to a string.


Syntax:

discord_social_client_status_to_string(status)
Argument Type Description
status DiscordClientStatus The status enum value.

Returns:

String



Back To Top

discord_social_client_thread_to_string

Discord Function: discordpp::Client::ThreadToString()

This function converts the Thread enum to a string.


Syntax:

discord_social_client_thread_to_string(thread)
Argument Type Description
thread DiscordClientThread The thread enum value.

Returns:

String



Back To Top

discord_social_client_remove_device_change_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_device_change_callback.


Syntax:

discord_social_client_remove_device_change_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_no_audio_input_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_no_audio_input_callback.


Syntax:

discord_social_client_remove_no_audio_input_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_voice_participant_changed_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_voice_participant_changed_callback.


Syntax:

discord_social_client_remove_voice_participant_changed_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_authorize_device_screen_closed_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_authorize_device_screen_closed_callback.


Syntax:

discord_social_client_remove_authorize_device_screen_closed_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_token_expiration_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_token_expiration_callback.


Syntax:

discord_social_client_remove_token_expiration_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_message_created_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_message_created_callback.


Syntax:

discord_social_client_remove_message_created_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_message_deleted_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_message_deleted_callback.


Syntax:

discord_social_client_remove_message_deleted_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_message_updated_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_message_updated_callback.


Syntax:

discord_social_client_remove_message_updated_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_log_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_add_log_callback.


Syntax:

discord_social_client_remove_log_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_status_changed_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_status_changed_callback.


Syntax:

discord_social_client_remove_status_changed_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_lobby_created_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_lobby_created_callback.


Syntax:

discord_social_client_remove_lobby_created_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_lobby_deleted_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_lobby_deleted_callback.


Syntax:

discord_social_client_remove_lobby_deleted_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_lobby_member_added_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_lobby_member_added_callback.


Syntax:

discord_social_client_remove_lobby_member_added_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_lobby_member_removed_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_lobby_member_removed_callback.


Syntax:

discord_social_client_remove_lobby_member_removed_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_lobby_member_updated_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_lobby_member_updated_callback.


Syntax:

discord_social_client_remove_lobby_member_updated_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_lobby_updated_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_lobby_updated_callback.


Syntax:

discord_social_client_remove_lobby_updated_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_activity_invite_created_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_activity_invite_created_callback.


Syntax:

discord_social_client_remove_activity_invite_created_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_activity_invite_updated_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_activity_invite_updated_callback.


Syntax:

discord_social_client_remove_activity_invite_updated_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_activity_join_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_activity_join_callback.


Syntax:

discord_social_client_remove_activity_join_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_relationship_created_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_relationship_created_callback.


Syntax:

discord_social_client_remove_relationship_created_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_relationship_deleted_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_relationship_deleted_callback.


Syntax:

discord_social_client_remove_relationship_deleted_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_relationship_groups_updated_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_relationship_groups_updated_callback.


Syntax:

discord_social_client_remove_relationship_groups_updated_callback()

Returns:

N/A



Back To Top

discord_social_client_remove_user_updated_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_client_set_user_updated_callback.


Syntax:

discord_social_client_remove_user_updated_callback()

Returns:

N/A



Back To Top

discord_social_client_create_authorization_code_verifier

Discord Function: discordpp::Client::CreateAuthorizationCodeVerifier

This is a helper function that can create a code verifier.


Syntax:

discord_social_client_create_authorization_code_verifier()

Returns:

String



Back To Top

discord_social_client_revoke_token

Discord Function: discordpp::Client::RevokeToken

This function revokes all application access/refresh tokens associated with a user with any valid access/refresh token. This will invalidate all tokens and they cannot be used again. This is useful if you want to log the user out of the game and invalidate their session.

Note

This function only works for public clients. Public clients are ones that do not have a backend server or their own concept of user accounts and simply rely on a separate system for authentication like Steam/Epic.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_revoke_token(application_id, token, callback)
Argument Type Description
application_id Real The application ID.
token String The token.
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result of the function call.


Back To Top

discord_social_client_exchange_child_token

Discord Function: discordpp::Client::ExchangeChildToken

Exchanges a parent application token for a child application token.

This is used to get a token for a child application that is linked to the parent application. This is only relevant if you have an applications set up in a parent/child relationship, which is applicable if you are a publisher with multiple games under the same account system. Access to this feature is currently limited.

Note

This function only works for public clients. Public clients are ones that do not have a backend server or their own concept of user accounts and simply rely on a separate system for authentication like Steam/Epic.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_exchange_child_token(parent_application_token, child_application_id, callback)
Argument Type Description
parent_application_token String The parent application token.
child_application_id Real The child application ID.
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result of the function call.
access_token String The access token.
expires_in Real The duration after which the token expires.
scopes String The scopes.


Back To Top

discord_social_client_unmerge_into_provisional_account

Discord Function: discordpp::Client::UnmergeIntoProvisionalAccount

This function is used to unlink/unmerge a external identity from a Discord account. This is useful if the user wants to unlink their external identity from their Discord account and create a new provisional account for that identity. This will invalidate all access/refresh tokens for the user and they cannot be used again.

This function should be used with the discord_social_client_get_provisional_token function to get a provisional token for the newly created provisional account.

Note

This function only works for public clients. Public clients are ones that do not have a backend server or their own concept of user accounts and simply rely on a separate system for authentication like Steam/Epic.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_unmerge_into_provisional_account(application_id, external_auth_type, external_auth_token, callback)
Argument Type Description
application_id Real The application ID.
external_auth_type DiscordAuthenticationExternalAuthType The external auth type.
external_auth_token String The external auth token.
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result of the request.


Back To Top

discord_social_client_register_authorize_request_callback

Discord Function: discordpp::Client::RegisterAuthorizeRequestCallback

Registers a callback to be invoked when a user requests to initiate the authorization flow.

When you register this callback, the Discord app will show new entry points to allow users to initiate the authorization flow.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_register_authorize_request_callback(callback)
Argument Type Description
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Invoked when a user requests to initiate the authorization flow from the Discord app. The callback receives no args and must call the functions needed to initiate the auth flow as if the user had clicked the account link button in the game.



Back To Top

discord_social_client_remove_authorize_request_callback

Discord Function: N /A

This function removes the callback function previously set with a call to discord_social_client_register_authorize_request_callback.


Syntax:

discord_social_client_remove_authorize_request_callback()

Returns:

N/A



Back To Top

discord_social_client_edit_user_message

Discord Function: discordpp::Client::EditUserMessage

This function edits the specified message sent by the current user to the specified recipient.

All of the same restrictions apply as for sending a message, see discord_social_client_send_user_message for more.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_edit_user_message(recipient_id, message_id, content, callback)
Argument Type Description
recipient_id Real The user ID of the recipient.
message_id Real The ID of the message.
content String The message's content.
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result of the request.


Back To Top

discord_social_client_get_lobby_messages_with_limit

Discord Function: discordpp::Client::GetLobbyMessagesWithLimit

This function retrieves recent messages from the specified lobby.

Returns a list of DiscordMessageHandle representing the recent messages in the lobby, with a maximum of 200 messages and up to 72 hours. The messages are returned in reverse chronological order (newest first). This function requires the current user to be a member of the lobby.

Retrieves recent messages from the specified lobby with the specified limit.

Note

This function makes an HTTP request to Discord's API to retrieve messages, as opposed to only returning messages that are cached locally by the SDK.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_lobby_messages_with_limit(lobby_id, limit, callback)
Argument Type Description
lobby_id Real The lobby ID.
limit Real The maximum number of messages to retrieve.
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result of the request.
messages Array of DiscordMessageHandle An array holding handles to the messages.


Back To Top

discord_social_client_get_user_message_summaries

Discord Function: discordpp::Client::GetUserMessageSummaries

This function retrieves message conversation summaries for all users the current user has DM conversations with.

The callback will be invoked with a list of DiscordUserMessageSummary structs.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_user_message_summaries(callback)
Argument Type Description
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result of the request.
summaries Array of DiscordUserMessageSummary An array of structs representing the summaries.


Back To Top

discord_social_client_get_user_messages_with_limit

Discord Function: discordpp::Client::GetUserMessagesWithLimit

This function retrieves messages from the DM conversation with the specified user.

Returns an array of DiscordMessageHandle in the callback function representing the recent messages in the conversation with the recipient, with a with a maximum of 200 messages and up to 72 hours. The messages are returned in reverse chronological order (newest first). This function checks the local cache first and only makes an HTTP request to Discord's API if there are not enough cached messages available.

If limit is greater than 0, restricts the number of messages returned. If limit is 0 or negative, the limit parameter is 200 messages and 72 hours. This is intended for games to load message history when users open a DM conversation.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_get_user_messages_with_limit(recipient_id, limit, callback)
Argument Type Description
recipient_id Real The user ID of the recipient.
limit Real The maximum number of messages to retrieve.
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result of the request.
messages Array of DiscordMessageHandle An array holding handles to the messages.


Back To Top

discord_social_client_join_linked_lobby_guild

Discord Function: discordpp::Client::JoinLinkedLobbyGuild

This function invites the current user to the Discord guild of the channel that is linked to the specified lobby. The user is forwarded to the Discord client with the resulting invite url, upon which the user can decide to accept or decline that invite.

On console platforms, the user is not navigated to any Discord client, so the invite url should be presented to the user in some way, so they can use it.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_join_linked_lobby_guild(lobby_id, provisional_user_merge_required_callback, callback)
Argument Type Description
lobby_id Real The lobby ID.
provisional_user_merge_required_callback Function The function to be called when provisional user merge is required.
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

This is triggered when discord_social_client_provisional_user_merge_completed completes.


Callback

Key Type Description
result DiscordClientResult The result of the request.
invite_url String The invite URL.


Back To Top

discord_social_client_set_activity_join_with_application_callback

Discord Function: discordpp::Client::SetActivityJoinWithApplicationCallback

This function sets a callback function that is invoked when the current user also has Discord running on their computer and they accept an activity invite in the Discord client.

This callback is invoked with the join secret from the activity rich presence, which you can use to join them to the game's internal party system. See Activity for more information on invites.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_activity_join_with_application_callback(callback)
Argument Type Description
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
application_id Real The application ID.
join_secret String The join secret.


Back To Top

discord_social_client_remove_activity_join_with_application_callback

Discord Function: N / A

This function removes the callback function previously set with a call to discord_social_client_set_activity_join_with_application_callback.


Syntax:

discord_social_client_remove_activity_join_with_application_callback()

Returns:

N/A



Back To Top

discord_social_client_set_relationship_groups_updated_callback

Discord Function: discordpp::Client::SetRelationshipGroupsUpdatedCallback

The RelationshipGroupsUpdatedCallback is invoked whenever any user in the friends list changes. This is intended to be the callback used to ensure the friends list is kept fresh. This can be used in tandem with discord_social_client_get_relationships_by_group to build and update the friends list.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_set_relationship_groups_updated_callback(callback)
Argument Type Description
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
user_id Real The user ID.


Back To Top

discord_social_client_is_discord_app_installed

Discord Function: discordpp::Client::IsDiscordAppInstalled

This function checks whether the Discord mobile app is installed on this device. On desktop platforms, always returns false.

This check does not require a client connection and can be called at any time.

This can be used to provide UI hints to users about whether they can authorize via the Discord app, or whether they will need to use a web browser flow.

Platform Requirements:

  • iOS: Your app must include "discord" in the LSApplicationQueriesSchemes array in your Info.plist for this check to work correctly.
  • Android: Your app must include "com.discord" in the queries element in your AndroidManifest.xml (required for Android 11+).

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_is_discord_app_installed(callback)
Argument Type Description
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
installed Boolean Whether Discord mobile app is installed.


Back To Top

discord_social_client_open_connected_games_settings_in_discord

Discord Function: discordpp::Client::OpenConnectedGamesSettingsInDiscord

This function opens the Connected Games settings in the Discord client, which is where users can manage their settings related to games using the Discord Social SDK.

If the client isn't connected or the user is a provisional account, this function does nothing.

It is always a no-op for console platforms.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_client_open_connected_games_settings_in_discord(callback)
Argument Type Description
callback Function The function to be called upon completion.

Returns:

N/A


Triggers:

Callback

Key Type Description
result DiscordClientResult The result of the request.


Clone this wiki locally