Discord๏ƒ

Inherits: Object

Discord Social SDK integration for RPC rich presence, OAuth, invites, and relationships.

Description๏ƒ

The Discord singleton dynamically loads the Discord Partner SDK library at runtime. Use initialize_presence_only() for auth-less RPC rich presence, or initialize() for the full OAuth social layer (friends, invites, server auth).

Pump run_callbacks() each frame (or rely on the engine frame hook) while the client is active.

Methods๏ƒ

void

accept_activity_invite(invite: Dictionary)

void

accept_discord_friend_request(user_id: int)

void

accept_game_friend_request(user_id: int)

DiscordAuthResult

authenticate_with_server(url: String, access_token: String, client_id: int)

void

block_user(user_id: int)

void

cancel_discord_friend_request(user_id: int)

void

cancel_game_friend_request(user_id: int)

void

clear_debug_log()

void

clear_rich_presence()

void

create_or_join_lobby(secret: String)

String

get_access_token() const

AuthState

get_auth_state() const

ConnectionState

get_connection_state() const

Array

get_debug_log() const

String

get_default_communication_scopes() const

String

get_default_presence_scopes() const

Dictionary

get_game_activity()

String

get_granted_scopes() const

String

get_last_error() const

Dictionary

get_relationship(user_id: int)

Array

get_relationships()

Array

get_relationships_by_group(group: RelationshipGroupType)

int

get_relationships_count() const

String

get_requested_scopes() const

Dictionary

get_user(user_id: int)

int

get_user_id() const

String

get_username() const

Dictionary

get_version() const

Error

initialize(client_id: int = 0)

Error

initialize_presence_only(client_id: int)

bool

is_authorization_pending() const

bool

is_authorized() const

bool

is_available()

bool

is_client_active() const

bool

is_debug_logging_enabled() const

bool

is_frame_hook_connected() const

bool

is_initialized() const

bool

is_presence_only_mode() const

bool

is_ready_for_presence() const

void

refresh_relationships()

bool

register_launch_command(application_id: int, command: String)

bool

register_launch_steam_application(application_id: int, steam_app_id: int)

void

reject_discord_friend_request(user_id: int)

void

reject_game_friend_request(user_id: int)

void

remove_discord_and_game_friend(user_id: int)

void

remove_game_friend(user_id: int)

void

run_callbacks()

void

send_activity_invite(user_id: int, content: String = "")

void

send_activity_join_request(user_id: int)

void

send_activity_join_request_reply(invite: Dictionary)

void

send_discord_friend_request(username: String)

void

send_discord_friend_request_by_id(user_id: int)

void

send_game_friend_request(username: String)

void

send_game_friend_request_by_id(user_id: int)

void

set_debug_logging(enabled: bool)

void

shutdown()

void

unblock_user(user_id: int)

Error

update_rich_presence(activity: Dictionary)


Signals๏ƒ

activity_invite_accepted(join_secret: String) ๐Ÿ”—

Emitted when the local user accepts an activity invite.


activity_invite_created(invite: Dictionary) ๐Ÿ”—

Emitted when a new activity invite is received.


activity_invite_sent() ๐Ÿ”—

Emitted after send_activity_invite() completes successfully.


activity_invite_updated(invite: Dictionary) ๐Ÿ”—

Emitted when an existing activity invite is updated.


activity_join_requested(join_secret: String) ๐Ÿ”—

Emitted when another user requests to join via the Discord client Join button.


authorization_failed(error: String) ๐Ÿ”—

Emitted when OAuth authorization fails.


authorization_started() ๐Ÿ”—

Emitted when OAuth authorization begins and the user must approve access.


authorized() ๐Ÿ”—

Emitted when OAuth authorization succeeds before the client reaches ready state.


connection_state_changed(state: int, error: int, error_detail: int) ๐Ÿ”—

Emitted when the Discord client connection state changes.


lobby_joined(lobby_id: int) ๐Ÿ”—

Emitted when create_or_join_lobby() succeeds.


ready() ๐Ÿ”—

Emitted when Discord is ready for rich presence updates.


relationship_action_completed(action: String, user_id: int, success: bool, error: String) ๐Ÿ”—

Emitted when an OAuth relationship action completes.


relationship_created(user_id: int, is_discord: bool) ๐Ÿ”—

Emitted when a new relationship is created. OAuth only.


relationship_deleted(user_id: int, is_discord: bool) ๐Ÿ”—

Emitted when a relationship is removed. OAuth only.


relationship_groups_updated(user_id: int) ๐Ÿ”—

Emitted when unified friends list groups should be refreshed. OAuth only.


relationships_updated(count: int) ๐Ÿ”—

Emitted when the relationship count is refreshed after connect.


rich_presence_updated(success: bool, error: String) ๐Ÿ”—

Emitted when a rich presence update completes.


user_updated(user_id: int) ๐Ÿ”—

Emitted when a Discord user's profile or status changes. OAuth only.


Enumerations๏ƒ

enum ConnectionState: ๐Ÿ”—

ConnectionState STATE_DISCONNECTED = 0

There is currently no description for this enum. Please help us by contributing one!

ConnectionState STATE_CONNECTING = 1

There is currently no description for this enum. Please help us by contributing one!

ConnectionState STATE_CONNECTED = 2

There is currently no description for this enum. Please help us by contributing one!

ConnectionState STATE_READY = 3

There is currently no description for this enum. Please help us by contributing one!

ConnectionState STATE_RECONNECTING = 4

There is currently no description for this enum. Please help us by contributing one!

ConnectionState STATE_DISCONNECTING = 5

There is currently no description for this enum. Please help us by contributing one!

ConnectionState STATE_HTTP_WAIT = 6

There is currently no description for this enum. Please help us by contributing one!


enum AuthState: ๐Ÿ”—

AuthState AUTH_NONE = 0

There is currently no description for this enum. Please help us by contributing one!

AuthState AUTH_PENDING = 1

There is currently no description for this enum. Please help us by contributing one!

AuthState AUTH_AUTHORIZED = 2

There is currently no description for this enum. Please help us by contributing one!

AuthState AUTH_READY = 3

There is currently no description for this enum. Please help us by contributing one!

AuthState AUTH_FAILED = 4

There is currently no description for this enum. Please help us by contributing one!


enum RelationshipType: ๐Ÿ”—

RelationshipType RELATIONSHIP_NONE = 0

There is currently no description for this enum. Please help us by contributing one!

RelationshipType RELATIONSHIP_FRIEND = 1

There is currently no description for this enum. Please help us by contributing one!

RelationshipType RELATIONSHIP_BLOCKED = 2

There is currently no description for this enum. Please help us by contributing one!

RelationshipType RELATIONSHIP_PENDING_INCOMING = 3

There is currently no description for this enum. Please help us by contributing one!

RelationshipType RELATIONSHIP_PENDING_OUTGOING = 4

There is currently no description for this enum. Please help us by contributing one!

RelationshipType RELATIONSHIP_IMPLICIT = 5

There is currently no description for this enum. Please help us by contributing one!

RelationshipType RELATIONSHIP_SUGGESTION = 6

There is currently no description for this enum. Please help us by contributing one!


enum RelationshipGroupType: ๐Ÿ”—

RelationshipGroupType GROUP_ONLINE_PLAYING_GAME = 0

There is currently no description for this enum. Please help us by contributing one!

RelationshipGroupType GROUP_ONLINE_ELSEWHERE = 1

There is currently no description for this enum. Please help us by contributing one!

RelationshipGroupType GROUP_OFFLINE = 2

There is currently no description for this enum. Please help us by contributing one!


enum StatusType: ๐Ÿ”—

StatusType STATUS_ONLINE = 0

There is currently no description for this enum. Please help us by contributing one!

StatusType STATUS_OFFLINE = 1

There is currently no description for this enum. Please help us by contributing one!

StatusType STATUS_BLOCKED = 2

There is currently no description for this enum. Please help us by contributing one!

StatusType STATUS_IDLE = 3

There is currently no description for this enum. Please help us by contributing one!

StatusType STATUS_DND = 4

There is currently no description for this enum. Please help us by contributing one!

StatusType STATUS_INVISIBLE = 5

There is currently no description for this enum. Please help us by contributing one!

StatusType STATUS_STREAMING = 6

There is currently no description for this enum. Please help us by contributing one!

StatusType STATUS_UNKNOWN = 7

There is currently no description for this enum. Please help us by contributing one!


Method Descriptions๏ƒ

void accept_activity_invite(invite: Dictionary) ๐Ÿ”—

Accepts an activity invite built from activity_invite_created / activity_invite_updated payload fields. Requires OAuth (AUTH_READY).


void accept_discord_friend_request(user_id: int) ๐Ÿ”—

Accepts a pending Discord-wide friend request. OAuth only. Emits relationship_action_completed.


void accept_game_friend_request(user_id: int) ๐Ÿ”—

Accepts a pending game-scoped friend request. OAuth only. Emits relationship_action_completed.


DiscordAuthResult authenticate_with_server(url: String, access_token: String, client_id: int) ๐Ÿ”—

POSTs the OAuth access token to the auth server and returns the parsed response. Requires AUTH_READY and a non-empty access token.


void block_user(user_id: int) ๐Ÿ”—

Blocks a user. OAuth only. Emits relationship_action_completed.


void cancel_discord_friend_request(user_id: int) ๐Ÿ”—

Cancels an outgoing Discord friend request. OAuth only.


void cancel_game_friend_request(user_id: int) ๐Ÿ”—

Cancels an outgoing game friend request. OAuth only.


void clear_debug_log() ๐Ÿ”—

Clears the in-memory debug log buffer.


void clear_rich_presence() ๐Ÿ”—

Clears the player's Discord rich presence. Requires presence readiness (is_ready_for_presence()).


void create_or_join_lobby(secret: String) ๐Ÿ”—

Creates or joins a Discord lobby by secret. OAuth only. Emits lobby_joined on success.


String get_access_token() const ๐Ÿ”—

Returns the OAuth access token obtained during initialize(), or an empty string when not connected.


AuthState get_auth_state() const ๐Ÿ”—

Returns the current OAuth/auth lifecycle state.


ConnectionState get_connection_state() const ๐Ÿ”—

Returns the current Discord SDK connection state.


Array get_debug_log() const ๐Ÿ”—

Returns recent lifecycle and SDK log lines.


String get_default_communication_scopes() const ๐Ÿ”—

Returns the default OAuth scopes for communication features.


String get_default_presence_scopes() const ๐Ÿ”—

Returns the default OAuth scopes for rich presence and friends list.


Dictionary get_game_activity() ๐Ÿ”—

Returns the current user's game-associated activity readback, or an empty dictionary when unavailable.


String get_granted_scopes() const ๐Ÿ”—

Returns the OAuth scopes granted by Discord after token exchange.


String get_last_error() const ๐Ÿ”—

Returns the most recent error message.


Dictionary get_relationship(user_id: int) ๐Ÿ”—

Returns a relationship dictionary for user_id, or empty when unavailable. OAuth only.


Array get_relationships() ๐Ÿ”—

Returns all relationships as an array of dictionaries. OAuth only.


Array get_relationships_by_group(group: RelationshipGroupType) ๐Ÿ”—

Returns relationships for a unified friends list group. OAuth only.


int get_relationships_count() const ๐Ÿ”—

Returns the cached relationships count after AUTH_READY, or -1 when unavailable.


String get_requested_scopes() const ๐Ÿ”—

Returns the OAuth scopes requested during the current auth flow.


Dictionary get_user(user_id: int) ๐Ÿ”—

Returns a user dictionary for user_id. OAuth only.


int get_user_id() const ๐Ÿ”—

Returns the connected Discord user snowflake ID after AUTH_READY, or 0.


String get_username() const ๐Ÿ”—

Returns the connected Discord display or username after AUTH_READY.


Dictionary get_version() const ๐Ÿ”—

Returns SDK version metadata and runtime library availability.


Error initialize(client_id: int = 0) ๐Ÿ”—

Initializes the Discord Social SDK and starts the OAuth authorization flow.


Error initialize_presence_only(client_id: int) ๐Ÿ”—

Initializes RPC rich presence without OAuth or initialize()'s connect step. Sets is_presence_only_mode() and emits ready immediately.


bool is_authorization_pending() const ๐Ÿ”—

Returns true while waiting for OAuth (AUTH_PENDING).


bool is_authorized() const ๐Ÿ”—

Returns true after token exchange succeeds.


bool is_available() ๐Ÿ”—

Returns true when the Discord Partner SDK runtime library is present.


bool is_client_active() const ๐Ÿ”—

Returns true while the SDK client session is active.


bool is_debug_logging_enabled() const ๐Ÿ”—

Returns whether debug logging is enabled.


bool is_frame_hook_connected() const ๐Ÿ”—

Returns whether the engine frame hook is connected for automatic callback pumping.


bool is_initialized() const ๐Ÿ”—

Returns true after a successful initialize() or initialize_presence_only().


bool is_presence_only_mode() const ๐Ÿ”—

Returns true when initialized via initialize_presence_only() (RPC, no OAuth).


bool is_ready_for_presence() const ๐Ÿ”—

Returns true when rich presence can be updated (RPC mode or AUTH_READY).


void refresh_relationships() ๐Ÿ”—

Refreshes the cached relationship count and emits relationships_updated. OAuth only.


bool register_launch_command(application_id: int, command: String) ๐Ÿ”—

Registers a custom launch command for Discord deep links. Works in RPC and OAuth modes.


bool register_launch_steam_application(application_id: int, steam_app_id: int) ๐Ÿ”—

Registers Steam launch integration for Discord join flows. Works in RPC and OAuth modes.


void reject_discord_friend_request(user_id: int) ๐Ÿ”—

Rejects a pending Discord friend request. OAuth only.


void reject_game_friend_request(user_id: int) ๐Ÿ”—

Rejects a pending game friend request. OAuth only.


void remove_discord_and_game_friend(user_id: int) ๐Ÿ”—

Removes both Discord and game friendship. OAuth only.


void remove_game_friend(user_id: int) ๐Ÿ”—

Removes a game-scoped friend. OAuth only.


void run_callbacks() ๐Ÿ”—

Pumps Discord SDK callbacks. Also invoked automatically each frame when initialized.


void send_activity_invite(user_id: int, content: String = "") ๐Ÿ”—

Sends an activity invite with optional message text. OAuth only. Emits activity_invite_sent.


void send_activity_join_request(user_id: int) ๐Ÿ”—

Sends a join request to another user. OAuth only.


void send_activity_join_request_reply(invite: Dictionary) ๐Ÿ”—

Replies to an activity join request invite. OAuth only.


void send_discord_friend_request(username: String) ๐Ÿ”—

Sends a Discord-wide friend request by username. OAuth only.


void send_discord_friend_request_by_id(user_id: int) ๐Ÿ”—

Sends a Discord-wide friend request by user ID. OAuth only.


void send_game_friend_request(username: String) ๐Ÿ”—

Sends a game-scoped friend request by username. OAuth only.


void send_game_friend_request_by_id(user_id: int) ๐Ÿ”—

Sends a game-scoped friend request by user ID. OAuth only.


void set_debug_logging(enabled: bool) ๐Ÿ”—

Enables verbose SDK file logging in user data.


void shutdown() ๐Ÿ”—

Shuts down the Discord SDK session and releases resources.


void unblock_user(user_id: int) ๐Ÿ”—

Unblocks a user. OAuth only.


Error update_rich_presence(activity: Dictionary) ๐Ÿ”—

Updates Discord rich presence. Keys include type, name, details, state, details_url, state_url, asset fields, invite_cover_image, status_display_type (name/state/details), supported_platforms (array or bitmask), party_id, party_current, party_max, join_secret, buttons ({label,url}), and timestamps. Cached if called before ready.