renamed discord_sdk to DiscordSDK to match the engines naming
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -11,27 +11,27 @@ extends Node
|
||||
## [codeblock]
|
||||
## func _ready():
|
||||
## # Application ID
|
||||
## discord_sdk.app_id = 1099618430065324082
|
||||
## DiscordSDK.app_id = 1099618430065324082
|
||||
## # this is boolean if everything worked
|
||||
## print("Discord working: " + str(discord_sdk.get_is_discord_working()))
|
||||
## print("Discord working: " + str(DiscordSDK.get_is_discord_working()))
|
||||
## # Set the first custom text row of the activity here
|
||||
## discord_sdk.details = "A demo activity by vaporvee#1231"
|
||||
## DiscordSDK.details = "A demo activity by vaporvee#1231"
|
||||
## # Set the second custom text row of the activity here
|
||||
## discord_sdk.state = "Checkpoint 23/23"
|
||||
## DiscordSDK.state = "Checkpoint 23/23"
|
||||
## # Image key for small image from "Art Assets" from the Discord Developer website
|
||||
## discord_sdk.large_image = "game"
|
||||
## DiscordSDK.large_image = "game"
|
||||
## # Tooltip text for the large image
|
||||
## discord_sdk.large_image_text = "Try it now!"
|
||||
## DiscordSDK.large_image_text = "Try it now!"
|
||||
## # Image key for large image from "Art Assets" from the Discord Developer website
|
||||
## discord_sdk.small_image = "boss"
|
||||
## DiscordSDK.small_image = "boss"
|
||||
## # Tooltip text for the small image
|
||||
## discord_sdk.small_image_text = "Fighting the end boss! D:"
|
||||
## DiscordSDK.small_image_text = "Fighting the end boss! D:"
|
||||
## # "02:41 elapsed" timestamp for the activity
|
||||
## discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
|
||||
## DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
|
||||
## # "59:59 remaining" timestamp for the activity
|
||||
## discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600
|
||||
## DiscordSDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600
|
||||
## # Always refresh after changing the values!
|
||||
## discord_sdk.refresh()
|
||||
## DiscordSDK.refresh()
|
||||
## [/codeblock]
|
||||
##
|
||||
## @tutorial(More information here): https://github.com/vaporvee/discord-sdk-godot/wiki/Quick-start
|
||||
|
@@ -9,10 +9,10 @@ resource_name = "Debug"
|
||||
script/source = "extends Node
|
||||
|
||||
func _ready():
|
||||
discord_sdk.connect(\"activity_join_request\",_on_activity_join_request)
|
||||
DiscordSDK.connect(\"activity_join_request\",_on_activity_join_request)
|
||||
|
||||
func _process(_delta):
|
||||
if(discord_sdk.get_is_discord_working()):
|
||||
if(DiscordSDK.get_is_discord_working()):
|
||||
$Panel/TextureRect.self_modulate = Color(\"#3eff8d\")
|
||||
$Panel/TextureRect/AnimationPlayer.play(\"pulsate\")
|
||||
debug_text_update()
|
||||
@@ -45,7 +45,7 @@ Is party public: {ppublic} (needs to be activated in Discord client settings)
|
||||
|
||||
Is instanced: {instanced}
|
||||
\"
|
||||
$Panel/Info.text = $Panel/Info.text.replace(\"{ppublic}\",str(discord_sdk.is_public_party)).replace(\"{instanced}\",str(discord_sdk.instanced)).replace(\"{ssecret}\",discord_sdk.spectate_secret).replace(\"{jsecret}\",discord_sdk.join_secret).replace(\"{msecret}\",discord_sdk.match_secret).replace(\"{mpartysize}\",str(discord_sdk.max_party_size)).replace(\"{cpartysize}\",str(discord_sdk.current_party_size)).replace(\"{partyid}\",discord_sdk.party_id).replace(\"{id}\",str(discord_sdk.app_id)).replace(\"{details}\",discord_sdk.details).replace(\"{state}\",discord_sdk.state).replace(\"{lkey}\",discord_sdk.large_image).replace(\"{ltext}\",discord_sdk.large_image_text).replace(\"{skey}\",discord_sdk.small_image).replace(\"{stext}\",discord_sdk.small_image_text).replace(\"{stimestamp}\",str(discord_sdk.start_timestamp)).replace(\"{etimestamp}\",str(discord_sdk.end_timestamp))
|
||||
$Panel/Info.text = $Panel/Info.text.replace(\"{ppublic}\",str(DiscordSDK.is_public_party)).replace(\"{instanced}\",str(DiscordSDK.instanced)).replace(\"{ssecret}\",DiscordSDK.spectate_secret).replace(\"{jsecret}\",DiscordSDK.join_secret).replace(\"{msecret}\",DiscordSDK.match_secret).replace(\"{mpartysize}\",str(DiscordSDK.max_party_size)).replace(\"{cpartysize}\",str(DiscordSDK.current_party_size)).replace(\"{partyid}\",DiscordSDK.party_id).replace(\"{id}\",str(DiscordSDK.app_id)).replace(\"{details}\",DiscordSDK.details).replace(\"{state}\",DiscordSDK.state).replace(\"{lkey}\",DiscordSDK.large_image).replace(\"{ltext}\",DiscordSDK.large_image_text).replace(\"{skey}\",DiscordSDK.small_image).replace(\"{stext}\",DiscordSDK.small_image_text).replace(\"{stimestamp}\",str(DiscordSDK.start_timestamp)).replace(\"{etimestamp}\",str(DiscordSDK.end_timestamp))
|
||||
|
||||
var user_request = {};
|
||||
|
||||
@@ -55,25 +55,25 @@ func _on_activity_join_request(user_requesting):
|
||||
|
||||
func _on_accept_join_request_pressed():
|
||||
if(!user_request.is_empty()):
|
||||
discord_sdk.accept_join_request(user_request.id)
|
||||
DiscordSDK.accept_join_request(user_request.id)
|
||||
|
||||
func _on_invite_with_user_id_text_submitted(new_text):
|
||||
discord_sdk.send_invite(int(new_text),true,\"this is a test invite sent from godot\")
|
||||
DiscordSDK.send_invite(int(new_text),true,\"this is a test invite sent from godot\")
|
||||
|
||||
func _on_accept_with_user_id_text_submitted(new_text):
|
||||
discord_sdk.accept_invite(int(new_text))
|
||||
DiscordSDK.accept_invite(int(new_text))
|
||||
|
||||
func _on_print_current_user_on_console_pressed():
|
||||
print(discord_sdk.get_current_user())
|
||||
print(DiscordSDK.get_current_user())
|
||||
|
||||
func _on_toggle_sdk_toggled(button_pressed):
|
||||
if(button_pressed):
|
||||
discord_sdk.unclear()
|
||||
DiscordSDK.unclear()
|
||||
else:
|
||||
discord_sdk.clear(false)
|
||||
DiscordSDK.clear(false)
|
||||
|
||||
func _on_print_friends_pressed():
|
||||
print(discord_sdk.get_all_relationships())
|
||||
print(DiscordSDK.get_all_relationships())
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8abo6"]
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## This is a GDscript Node wich gets automatically added as Autoload while installing the addon.
|
||||
##
|
||||
## It can run in the background to comunicate with Discord.
|
||||
## You don't need to use it unless you are using EditorPresence. If you remove it make sure to run [code]discord_sdk.run_callbacks()[/code] in a [code]_process[/code] function.
|
||||
## You don't need to use it unless you are using EditorPresence. If you remove it make sure to run [code]DiscordSDK.run_callbacks()[/code] in a [code]_process[/code] function.
|
||||
##
|
||||
## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki
|
||||
@tool
|
||||
@@ -11,13 +11,13 @@ class_name DiscordSDKLoaderAutoload
|
||||
func _process(_delta) -> void:
|
||||
if GDExtensionManager.get_loaded_extensions().has("res://addons/discord-sdk-gd/bin/discord-rpc-gd.gdextension"):
|
||||
if ProjectSettings.get_setting("DiscordSDK/EditorPresence/enabled",false) && Engine.is_editor_hint():
|
||||
if discord_sdk.app_id != 1108142249990176808:
|
||||
discord_sdk.app_id = 1108142249990176808
|
||||
discord_sdk.details = ProjectSettings.get_setting("application/config/name")
|
||||
discord_sdk.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\""
|
||||
discord_sdk.large_image = "godot"
|
||||
discord_sdk.large_image_text = str(Engine.get_version_info().string)
|
||||
discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
|
||||
discord_sdk.refresh()
|
||||
if discord_sdk.app_id == 1108142249990176808 || !Engine.is_editor_hint():
|
||||
discord_sdk.run_callbacks()
|
||||
if DiscordSDK.app_id != 1108142249990176808:
|
||||
DiscordSDK.app_id = 1108142249990176808
|
||||
DiscordSDK.details = ProjectSettings.get_setting("application/config/name")
|
||||
DiscordSDK.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\""
|
||||
DiscordSDK.large_image = "godot"
|
||||
DiscordSDK.large_image_text = str(Engine.get_version_info().string)
|
||||
DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
|
||||
DiscordSDK.refresh()
|
||||
if DiscordSDK.app_id == 1108142249990176808 || !Engine.is_editor_hint():
|
||||
DiscordSDK.run_callbacks()
|
||||
|
@@ -25,7 +25,7 @@ func _on_confirmed():
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
|
||||
|
||||
[sub_resource type="Image" id="Image_3lxeh"]
|
||||
[sub_resource type="Image" id="Image_3se7o"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 168, 224, 224, 224, 233, 224, 224, 224, 236, 224, 224, 224, 170, 231, 231, 231, 31, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 234, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 239, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 168, 224, 224, 224, 255, 224, 224, 224, 186, 224, 224, 224, 32, 224, 224, 224, 33, 224, 224, 224, 187, 224, 224, 224, 255, 225, 225, 225, 167, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 255, 224, 224, 224, 234, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 38, 224, 224, 224, 255, 224, 224, 224, 229, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 164, 224, 224, 224, 255, 224, 224, 224, 187, 225, 225, 225, 34, 227, 227, 227, 36, 224, 224, 224, 192, 224, 224, 224, 255, 224, 224, 224, 162, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 225, 225, 225, 215, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 229, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 224, 224, 224, 216, 224, 224, 224, 255, 224, 224, 224, 210, 224, 224, 224, 161, 224, 224, 224, 232, 224, 224, 224, 231, 225, 225, 225, 159, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 255, 224, 224, 224, 210, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 224, 224, 224, 130, 255, 255, 255, 1, 255, 255, 255, 1, 225, 225, 225, 134, 224, 224, 224, 224, 225, 225, 225, 223, 224, 224, 224, 132, 255, 255, 255, 1, 255, 255, 255, 6, 224, 224, 224, 137, 224, 224, 224, 231, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 130, 225, 225, 225, 133, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 129, 224, 224, 224, 137, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 220, 225, 225, 225, 223, 224, 224, 224, 255, 226, 226, 226, 61, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 222, 224, 224, 224, 231, 224, 224, 224, 255, 227, 227, 227, 62, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 222, 224, 224, 224, 255, 227, 227, 227, 63, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 230, 224, 224, 224, 255, 227, 227, 227, 63, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 127, 224, 224, 224, 129, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 126, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 1, 224, 224, 224, 128, 224, 224, 224, 220, 224, 224, 224, 219, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 5, 225, 225, 225, 134, 224, 224, 224, 229, 224, 224, 224, 255, 255, 255, 255, 0),
|
||||
"format": "RGBA8",
|
||||
@@ -35,7 +35,7 @@ data = {
|
||||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
|
||||
image = SubResource("Image_3lxeh")
|
||||
image = SubResource("Image_3se7o")
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
|
||||
|
||||
|
@@ -2,40 +2,40 @@ extends Node
|
||||
|
||||
func _ready() -> void:
|
||||
set_activity()
|
||||
discord_sdk.connect("activity_join_request",_on_activity_join_request)
|
||||
discord_sdk.connect("activity_join",_on_activity_join)
|
||||
discord_sdk.connect("activity_spectate",_on_activity_spectate)
|
||||
discord_sdk.connect("relationships_init",_on_relationship_init)
|
||||
discord_sdk.connect("updated_relationship", _on_updated_relationship)
|
||||
DiscordSDK.connect("activity_join_request",_on_activity_join_request)
|
||||
DiscordSDK.connect("activity_join",_on_activity_join)
|
||||
DiscordSDK.connect("activity_spectate",_on_activity_spectate)
|
||||
DiscordSDK.connect("relationships_init",_on_relationship_init)
|
||||
DiscordSDK.connect("updated_relationship", _on_updated_relationship)
|
||||
|
||||
func set_activity() -> void:
|
||||
discord_sdk.clear(false)
|
||||
discord_sdk.app_id = 1099618430065324082
|
||||
discord_sdk.details = "A demo activity by vaporvee#1231"
|
||||
discord_sdk.state = "Checkpoint 23/23"
|
||||
DiscordSDK.clear(false)
|
||||
DiscordSDK.app_id = 1099618430065324082
|
||||
DiscordSDK.details = "A demo activity by vaporvee#1231"
|
||||
DiscordSDK.state = "Checkpoint 23/23"
|
||||
|
||||
discord_sdk.large_image = "example_game"
|
||||
discord_sdk.large_image_text = "Try it now!"
|
||||
discord_sdk.small_image = "boss"
|
||||
discord_sdk.small_image_text = "Fighting the end boss! D:"
|
||||
discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
|
||||
DiscordSDK.large_image = "example_game"
|
||||
DiscordSDK.large_image_text = "Try it now!"
|
||||
DiscordSDK.small_image = "boss"
|
||||
DiscordSDK.small_image_text = "Fighting the end boss! D:"
|
||||
DiscordSDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
|
||||
|
||||
# It is NOT recommended to manage secrets locally! It's meant to be a payload wich the server understands and
|
||||
# returns the other variables like current_party_size, party_id etc. Most of the values must differ from the others.
|
||||
var my_secret: String = str(randi_range(0,999999))
|
||||
|
||||
discord_sdk.party_id = "mylobbycanbeeverything_" + my_secret
|
||||
discord_sdk.current_party_size = 1
|
||||
discord_sdk.max_party_size = 4
|
||||
discord_sdk.match_secret = "m_" + my_secret #better use seeds with 1 to 1 range instead of just chars
|
||||
discord_sdk.join_secret = "j_" + my_secret
|
||||
discord_sdk.spectate_secret = "s_" + my_secret
|
||||
discord_sdk.is_public_party = true
|
||||
discord_sdk.instanced = true #required for spectate
|
||||
#discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
|
||||
discord_sdk.register_command(r"C:\Users\yanni\Desktop\demo\discord_sdk.exe")
|
||||
#discord_sdk.register_steam(1389990)
|
||||
discord_sdk.refresh()
|
||||
DiscordSDK.party_id = "mylobbycanbeeverything_" + my_secret
|
||||
DiscordSDK.current_party_size = 1
|
||||
DiscordSDK.max_party_size = 4
|
||||
DiscordSDK.match_secret = "m_" + my_secret #better use seeds with 1 to 1 range instead of just chars
|
||||
DiscordSDK.join_secret = "j_" + my_secret
|
||||
DiscordSDK.spectate_secret = "s_" + my_secret
|
||||
DiscordSDK.is_public_party = true
|
||||
DiscordSDK.instanced = true #required for spectate
|
||||
#DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
|
||||
DiscordSDK.register_command(r"C:\Users\yanni\Desktop\demo\DiscordSDK.exe")
|
||||
#DiscordSDK.register_steam(1389990)
|
||||
DiscordSDK.refresh()
|
||||
|
||||
var user_request: Dictionary;
|
||||
|
||||
@@ -44,13 +44,13 @@ func _on_activity_join_request(user_requesting) -> void:
|
||||
user_request = user_requesting
|
||||
|
||||
func _on_activity_join(secret) -> void:
|
||||
if(discord_sdk.join_secret != secret):
|
||||
discord_sdk.current_party_size = clamp(int(secret) + 1, 0, discord_sdk.max_party_size)
|
||||
discord_sdk.party_id = secret.replace("j_","mylobbycanbeeverything_")
|
||||
discord_sdk.match_secret = secret.replace("j_","m_")
|
||||
discord_sdk.join_secret = secret
|
||||
discord_sdk.spectate_secret = secret.replace("j_","s_")
|
||||
discord_sdk.refresh()
|
||||
if(DiscordSDK.join_secret != secret):
|
||||
DiscordSDK.current_party_size = clamp(int(secret) + 1, 0, DiscordSDK.max_party_size)
|
||||
DiscordSDK.party_id = secret.replace("j_","mylobbycanbeeverything_")
|
||||
DiscordSDK.match_secret = secret.replace("j_","m_")
|
||||
DiscordSDK.join_secret = secret
|
||||
DiscordSDK.spectate_secret = secret.replace("j_","s_")
|
||||
DiscordSDK.refresh()
|
||||
|
||||
func _on_activity_spectate(secret) -> void:
|
||||
print(secret)
|
||||
|
Reference in New Issue
Block a user