Up to date

This page is up to date for Godot 4.3. If you still find outdated information, please open an issue.

DiscordEmbeddedAppClientยถ

Inherits: ThirdPartyClient < Node < Object

Node for connecting to the Discord Embedded App service.

Descriptionยถ

Implementation based on the official Discord Embedded App SDK for JS. Official documentation for this service on discord.com/developers/docs/developer-tools/embedded-app-sdk.

Propertiesยถ

String

channel_id

""

String

client_id

""

String

custom_id

""

String

frame_id

""

String

guild_id

""

String

location_id

""

String

mobile_app_version

""

String

platform

""

String

referrer_id

""

String

sdk_version

"1.9.0"

String

user_id

""

String

user_instance_id

""

Methodsยถ

DiscordEmbeddedAppResponse

authenticate(access_token: String)

DiscordEmbeddedAppResponse

authorize(response_type: String, state: String, prompt: String, scope: Array)

DiscordEmbeddedAppResponse

capture_log(level: String, message: String)

void

close(code: int, message: String)

DiscordEmbeddedAppResponse

encourage_hardware_acceleration()

DiscordEmbeddedAppResponse

get_channel(channel_id: String)

DiscordEmbeddedAppResponse

get_channel_permissions()

DiscordEmbeddedAppResponse

get_entitlements()

DiscordEmbeddedAppResponse

get_instance_connected_participants()

DiscordEmbeddedAppResponse

get_platform_behaviours()

DiscordEmbeddedAppResponse

get_skus()

DiscordEmbeddedAppResponse

initiate_image_upload()

bool

is_discord_environment()

DiscordEmbeddedAppResponse

is_ready()

DiscordEmbeddedAppResponse

open_external_link(url: String)

DiscordEmbeddedAppResponse

open_invite_dialog()

DiscordEmbeddedAppResponse

open_share_moment_dialog(media_url: String)

DiscordEmbeddedAppResponse

set_activity(activity: Dictionary)

DiscordEmbeddedAppResponse

set_config(use_interactive_pip: bool)

DiscordEmbeddedAppResponse

set_orientation_lock_state(lock_state: DiscordEmbeddedAppOrientationLockState, picture_in_picture_lock_state: DiscordEmbeddedAppOrientationLockState, grid_lock_state: DiscordEmbeddedAppOrientationLockState)

DiscordEmbeddedAppResponse

start_purchase(sku_id: String, pid: String)

void

subscribe_to_all_events()

DiscordEmbeddedAppResponse

user_settings_get_locale()


Signalsยถ

activity_instance_participants_update(data: Dictionary) ๐Ÿ”—

Received when the number of instance participants changes.


activity_layout_mode_update(data: Dictionary) ๐Ÿ”—

Received when a user changes the layout mode in the Discord client.


current_guild_member_update(data: Dictionary) ๐Ÿ”—

Received when the current guild member object changes.


current_user_update(data: Dictionary) ๐Ÿ”—

Received when the current user object changes.


entitlement_create(data: Dictionary) ๐Ÿ”—

Received when an entitlement is created for a SKU.


error(data: Dictionary) ๐Ÿ”—

Non-subscription event sent when there is an error, including command responses.


log_updated(command: String, logs: String) ๐Ÿ”—

Received when logs are updated.


orientation_update(data: Dictionary) ๐Ÿ”—

Received when screen orientation changes.


speaking_start(data: Dictionary) ๐Ÿ”—

Sent when a user in a subscribed voice channel speaks.


speaking_stop(data: Dictionary) ๐Ÿ”—

Sent when a user in a subscribed voice channel stops speaking.


thermal_state_update(data: Dictionary) ๐Ÿ”—

Received when Android or iOS thermal states are surfaced to the Discord app.


voice_state_update(data: Dictionary) ๐Ÿ”—

Sent when a user's voice state changes in a subscribed voice channel (mute, volume, etc.).


Enumerationsยถ

enum DiscordEmbeddedAppOrientationLockState: ๐Ÿ”—

DiscordEmbeddedAppOrientationLockState DISCORD_EMBEDDED_APP_ORIENTATION_LOCK_STATE_UNHANDLED = -1

Unhandled orientation lock state.

DiscordEmbeddedAppOrientationLockState DISCORD_EMBEDDED_APP_ORIENTATION_LOCK_STATE_UNLOCKED = 1

Unlocked orientation lock state.

DiscordEmbeddedAppOrientationLockState DISCORD_EMBEDDED_APP_ORIENTATION_LOCK_STATE_PORTRAIT = 2

Locked portrait orientation lock state.

DiscordEmbeddedAppOrientationLockState DISCORD_EMBEDDED_APP_ORIENTATION_LOCK_STATE_LANDSCAPE = 3

Locked landscape orientation lock state.


Property Descriptionsยถ

String channel_id = "" ๐Ÿ”—

The id of a channel. A channel represents a guild or DM channel within Discord.


String client_id = "" ๐Ÿ”—

The client id you want to use when starting the client.


String custom_id = "" ๐Ÿ”—

Custom ID.


String frame_id = "" ๐Ÿ”—

Frame ID.


String guild_id = "" ๐Ÿ”—

Guilds in Discord represent an isolated collection of users and channels, and are often referred to as "servers" in the UI.


String location_id = "" ๐Ÿ”—

Location ID.


String mobile_app_version = "" ๐Ÿ”—

  • String get_mobile_app_version()

Only if on mobile.


String platform = "" ๐Ÿ”—

The platform, web, ios or android.


String referrer_id = "" ๐Ÿ”—

The id of the referrer.


String sdk_version = "1.9.0" ๐Ÿ”—

The version of the Discord Embedded App used.


String user_id = "" ๐Ÿ”—

User ID.


String user_instance_id = "" ๐Ÿ”—

  • String get_user_instance_id()

Instance ID.


Method Descriptionsยถ

DiscordEmbeddedAppResponse authenticate(access_token: String) ๐Ÿ”—

Authenticate an existing client with your app. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#authenticate

var res :DiscordEmbeddedAppResult = await authenticate("ACCESS_TOKEN").finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse authorize(response_type: String, state: String, prompt: String, scope: Array) ๐Ÿ”—

Authorize a new client with your app. Needs client_id to be set.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#authorize

var res :DiscordEmbeddedAppResult = await authorize("code", "", "none", ["identity", "guilds"]).finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse capture_log(level: String, message: String) ๐Ÿ”—

Forward logs to your own logger. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#capturelog

var res :DiscordEmbeddedAppResult = await capture_log("log", "This is my log message!").finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


void close(code: int, message: String) ๐Ÿ”—

Close an Embedded App. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#close

var res :DiscordEmbeddedAppResult = await close(1000, "You exited app.").finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

DiscordEmbeddedAppResponse encourage_hardware_acceleration() ๐Ÿ”—

Presents a modal dialog to allow enabling of hardware acceleration. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#encouragehardwareacceleration

var res :DiscordEmbeddedAppResult = await encourage_hardware_acceleration().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse get_channel(channel_id: String) ๐Ÿ”—

Returns information about the channel, per the channel_id. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#getchannel

var res :DiscordEmbeddedAppResult = await get_channel("channel_id").finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse get_channel_permissions() ๐Ÿ”—

Returns permissions for the current user in the currently connected channel. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#getchannelpermissions

var res :DiscordEmbeddedAppResult = await get_channel_permissions().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse get_entitlements() ๐Ÿ”—

Returns a list of entitlements for the current user. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#getentitlements

var res :DiscordEmbeddedAppResult = await get_entitlements().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse get_instance_connected_participants() ๐Ÿ”—

Returns all participants connected to the instance. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#getinstanceconnectedparticipants

var res :DiscordEmbeddedAppResult = await get_instance_connected_participants().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse get_platform_behaviours() ๐Ÿ”—

Returns information about supported platform behaviors. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#getplatformbehaviors

var res :DiscordEmbeddedAppResult = await get_platform_behaviours().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse get_skus() ๐Ÿ”—

Returns a list of your app's SKUs. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#getskus

var res :DiscordEmbeddedAppResult = await get_skus().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse initiate_image_upload() ๐Ÿ”—

Presents the file upload flow in the Discord client. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#initiateimageupload

var res :DiscordEmbeddedAppResult = await initiate_image_upload().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


bool is_discord_environment() ๐Ÿ”—

Returns whether or not the current environment is Discord environment.

if is_discord_environment():
    print("This is discord environment")

DiscordEmbeddedAppResponse is_ready() ๐Ÿ”—

Returns whether or not the client is ready.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#ready

var res :DiscordEmbeddedAppResult = await is_ready().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


Allows for opening an external link from within the Discord client. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#openexternallink

var res :DiscordEmbeddedAppResult = await open_external_link("url").finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse open_invite_dialog() ๐Ÿ”—

Presents a modal dialog with Channel Invite UI without requiring additional OAuth scopes. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#openinvitedialog

var res :DiscordEmbeddedAppResult = await open_invite_dialog().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse open_share_moment_dialog(media_url: String) ๐Ÿ”—

Presents a modal dialog to share media to a channel or DM. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#opensharemomentdialog

var res :DiscordEmbeddedAppResult = await open_share_moment_dialog().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse set_activity(activity: Dictionary) ๐Ÿ”—

Modifies how your activity's rich presence is displayed in the Discord client. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#setactivity

var res :DiscordEmbeddedAppResult = await set_activity({"type": 0, "details": "Details", "state": "Playing"}).finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse set_config(use_interactive_pip: bool) ๐Ÿ”—

Set whether or not the PIP (picture-in-picture) is interactive. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#setconfig

var res :DiscordEmbeddedAppResult = await set_config(true).finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse set_orientation_lock_state(lock_state: DiscordEmbeddedAppOrientationLockState, picture_in_picture_lock_state: DiscordEmbeddedAppOrientationLockState, grid_lock_state: DiscordEmbeddedAppOrientationLockState) ๐Ÿ”—

Set options for orientation and picture-in-picture (PIP) modes. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#setorientationlockstate

var res :DiscordEmbeddedAppResult = await set_orientation_lock_state(DiscordEmbeddedAppClient.DISCORD_EMBEDDED_APP_ORIENTATION_LOCK_STATE_UNLOCKED, DiscordEmbeddedAppClient.DISCORD_EMBEDDED_APP_ORIENTATION_LOCK_STATE_UNLOCKED, DiscordEmbeddedAppClient.DISCORD_EMBEDDED_APP_ORIENTATION_LOCK_STATE_UNLOCKED).finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


DiscordEmbeddedAppResponse start_purchase(sku_id: String, pid: String) ๐Ÿ”—

Launches the purchase flow for a specific SKU, per the sku_id. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#startpurchase

var res :DiscordEmbeddedAppResult = await start_purchase("sku_id", "pid").finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.


void subscribe_to_all_events() ๐Ÿ”—

Subscribes to all events. Needs to be done after authenticate. Wait for is_ready first.

subscribe_to_all_events()

DiscordEmbeddedAppResponse user_settings_get_locale() ๐Ÿ”—

Returns the current user's locale. Wait for is_ready first.

Discord docs discord.com/developers/docs/developer-tools/embedded-app-sdk#usersettingsgetlocale

var res :DiscordEmbeddedAppResult = await user_settings_get_locale().finished
if res.has_error():
    print(res.error)
else:
    print(res.data)

Returns a DiscordEmbeddedAppResponse object that has a DiscordEmbeddedAppResponse.finished signal that is emitted when finished.