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ยถ
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methodsยถ
authenticate(access_token: String) |
|
authorize(response_type: String, state: String, prompt: String, scope: Array) |
|
capture_log(level: String, message: String) |
|
void |
|
get_channel(channel_id: String) |
|
get_skus() |
|
is_ready() |
|
open_external_link(url: String) |
|
open_share_moment_dialog(media_url: String) |
|
set_activity(activity: Dictionary) |
|
set_config(use_interactive_pip: bool) |
|
set_orientation_lock_state(lock_state: DiscordEmbeddedAppOrientationLockState, picture_in_picture_lock_state: DiscordEmbeddedAppOrientationLockState, grid_lock_state: DiscordEmbeddedAppOrientationLockState) |
|
start_purchase(sku_id: String, pid: String) |
|
void |
|
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 get_channel_id()
The id of a channel. A channel represents a guild or DM channel within Discord.
String get_client_id()
The client id you want to use when starting the client.
String get_custom_id()
Custom ID.
String get_frame_id()
Frame ID.
String get_guild_id()
Guilds in Discord represent an isolated collection of users and channels, and are often referred to as "servers" in the UI.
String get_location_id()
Location ID.
String mobile_app_version = ""
๐
String get_mobile_app_version()
Only if on mobile.
String get_platform()
The platform, web, ios or android.
String get_referrer_id()
The id of the referrer.
String sdk_version = "1.9.0"
๐
String get_sdk_version()
The version of the Discord Embedded App used.
String get_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.
DiscordEmbeddedAppResponse open_external_link(url: String) ๐
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.
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.