Merge pull request #17 from vaporvee/just-add-invites-already
Just add invites already
This commit is contained in:
5
.vscode/c_cpp_properties.json
vendored
5
.vscode/c_cpp_properties.json
vendored
@@ -3,7 +3,10 @@
|
|||||||
{
|
{
|
||||||
"name": "Win32",
|
"name": "Win32",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${default}"
|
"${default}",
|
||||||
|
"${workspaceFolder}/src/lib/godot-cpp/gen/include",
|
||||||
|
"${workspaceFolder}/src/lib/godot-cpp/include",
|
||||||
|
"${workspaceFolder}/src/lib/godot-cpp/gdextension"
|
||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
"_DEBUG",
|
"_DEBUG",
|
||||||
|
64
.vscode/settings.json
vendored
64
.vscode/settings.json
vendored
@@ -1,11 +1,67 @@
|
|||||||
{
|
{
|
||||||
"C_Cpp.default.includePath": [
|
"C_Cpp.default.includePath": [
|
||||||
"src/lib/godot-cpp/include",
|
"${workspaceFolder}/src/lib/godot-cpp/gen/include",
|
||||||
"src/lib/godot-cpp/gen/include",
|
"${workspaceFolder}/src/lib/godot-cpp/include"
|
||||||
"src/lib/godot-cpp/gdextension"
|
|
||||||
],
|
],
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"xlocbuf": "cpp"
|
"xlocbuf": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"compare": "cpp",
|
||||||
|
"concepts": "cpp",
|
||||||
|
"csignal": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"ios": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"set": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"stop_token": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"typeinfo": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"xfacet": "cpp",
|
||||||
|
"xhash": "cpp",
|
||||||
|
"xiosbase": "cpp",
|
||||||
|
"xlocale": "cpp",
|
||||||
|
"xlocinfo": "cpp",
|
||||||
|
"xlocnum": "cpp",
|
||||||
|
"xmemory": "cpp",
|
||||||
|
"xstddef": "cpp",
|
||||||
|
"xstring": "cpp",
|
||||||
|
"xtr1common": "cpp",
|
||||||
|
"xtree": "cpp",
|
||||||
|
"xutility": "cpp"
|
||||||
},
|
},
|
||||||
"[python]": {
|
"[python]": {
|
||||||
"editor.defaultFormatter": "ms-python.black-formatter"
|
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||||
|
41
README.md
41
README.md
@@ -1,7 +1,48 @@
|
|||||||
<img src="/project/assets/Banner.svg" alt="Project Banner" />
|
<img src="/project/assets/Banner.svg" alt="Project Banner" />
|
||||||
|
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
### :warning: This is an early version! MacOS support still doesn't work! In future versions there also will be invites, user info etc. very soon!
|
||||||
|
Don't forget to run the following command **if you clone this project** or files will be missing
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python setup.py
|
||||||
|
```
|
||||||
|
# Addon Usage :rocket:
|
||||||
|
1. [Download the addon](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/ADDON-Discord-SDK-Godot.zip/)
|
||||||
|
2. Put the `addons/` folder in your Godot project
|
||||||
|
3. Enable the addon in your Project Settings under "Plugins" and "DiscordSDK". (if it doesn't show up restart your project and try again)
|
||||||
|
4. Restart your project
|
||||||
|
5. Create an Application under https://discord.com/developers/applications and get the Application ID
|
||||||
|
6. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys
|
||||||
|
```gdscript
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
discord_sdk.app_id = 1099618430065324082 # Application ID
|
||||||
|
print("Discord working: " + str(discord_sdk.get_is_discord_working())) # A boolean if everything worked
|
||||||
|
discord_sdk.details = "A demo activity by vaporvee#1231"
|
||||||
|
discord_sdk.state = "Checkpoint 23/23"
|
||||||
|
|
||||||
|
discord_sdk.large_image = "game" # Image key from "Art Assets"
|
||||||
|
discord_sdk.large_image_text = "Try it now!"
|
||||||
|
discord_sdk.small_image = "boss" # Image key from "Art Assets"
|
||||||
|
discord_sdk.small_image_text = "Fighting the end boss! D:"
|
||||||
|
|
||||||
|
discord_sdk.start_timestamp = int(Time.get_unix_time_from_system()) # "02:46 elapsed"
|
||||||
|
# discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time / "01:00 remaining"
|
||||||
|
|
||||||
|
discord_sdk.refresh() # Always refresh after changing the values!
|
||||||
|
|
||||||
|
```
|
||||||
|
#### Then it will look similar to this:
|
||||||
|
<img src="/project/assets/ActivityPreview.svg" alt="Activity Preview" />
|
||||||
|
|
||||||
|
### [Try a built demo](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/Demo-Export.zip)
|
||||||
|
:incoming_envelope: Still questions? write an [issue](https://github.com/vaporvee/discord-sdk-godot/issues)! I'll answer very fast :)
|
||||||
|
=======
|
||||||
**:warning: This is an early version! MacOS support still doesn't work! In future versions there also will be invites, user info etc. very soon!**
|
**:warning: This is an early version! MacOS support still doesn't work! In future versions there also will be invites, user info etc. very soon!**
|
||||||
|
>>>>>>> fa63df6094ecc20735383edff8de3b017ea2ad24
|
||||||
|
|
||||||
**Discord Game SDK support for GDScript in Godot Engine 4.0. with the easiest code pattern!**<br><br>
|
**Discord Game SDK support for GDScript in Godot Engine 4.0. with the easiest code pattern!**<br><br>
|
||||||
**Please leave a star that would really help! And thanks to all the people that already starred this project! ❤️**
|
**Please leave a star that would really help! And thanks to all the people that already starred this project! ❤️**
|
||||||
|
BIN
discord_addon_export_beta.zip
Normal file
BIN
discord_addon_export_beta.zip
Normal file
Binary file not shown.
BIN
project/Node
Normal file
BIN
project/Node
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Binary file not shown.
@@ -9,17 +9,17 @@ extends Node
|
|||||||
#SELECT THE TEXT WITH YOUR MOUSE AND CTR + K TO UNCOMMENT THE FOLLOWING
|
#SELECT THE TEXT WITH YOUR MOUSE AND CTR + K TO UNCOMMENT THE FOLLOWING
|
||||||
|
|
||||||
#func _ready():
|
#func _ready():
|
||||||
# Discord_Activity.app_id = 1099618430065324082 # Application ID
|
# discord_sdk.app_id = 1099618430065324082 # Application ID
|
||||||
# print("Discord working: " + str(Discord_Activity.get_is_discord_working())) # A boolean if everything worked
|
# print("Discord working: " + str(discord_sdk.get_is_discord_working())) # A boolean if everything worked
|
||||||
# Discord_Activity.details = "A demo activity by vaporvee#1231"
|
# discord_sdk.details = "A demo activity by vaporvee#1231"
|
||||||
# Discord_Activity.state = "Checkpoint 23/23"
|
# discord_sdk.state = "Checkpoint 23/23"
|
||||||
#
|
#
|
||||||
# Discord_Activity.large_image = "game" # Image key from "Art Assets"
|
# discord_sdk.large_image = "game" # Image key from "Art Assets"
|
||||||
# Discord_Activity.large_image_text = "Try it now!"
|
# discord_sdk.large_image_text = "Try it now!"
|
||||||
# Discord_Activity.small_image = "boss" # Image key from "Art Assets"
|
# discord_sdk.small_image = "boss" # Image key from "Art Assets"
|
||||||
# Discord_Activity.small_image_text = "Fighting the end boss! D:"
|
# discord_sdk.small_image_text = "Fighting the end boss! D:"
|
||||||
#
|
#
|
||||||
# Discord_Activity.start_timestamp = int(Time.get_unix_time_from_system()) # "02:41 elapsed"
|
# discord_sdk.start_timestamp = int(Time.get_unix_time_from_system()) # "02:41 elapsed"
|
||||||
# Discord_Activity.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
|
# discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
|
||||||
#
|
#
|
||||||
# Discord_Activity.refresh() # Always refresh after changing the values!
|
# discord_sdk.refresh() # Always refresh after changing the values!
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta) -> void:
|
||||||
Discord_Activity.coreupdate()
|
discord_sdk.coreupdate()
|
||||||
|
BIN
project/assets/1.png
Normal file
BIN
project/assets/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
34
project/assets/1.png.import
Normal file
34
project/assets/1.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://ht210p8vs8s7"
|
||||||
|
path="res://.godot/imported/1.png-c9a8e694d0d275633d567702fb508122.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/1.png"
|
||||||
|
dest_files=["res://.godot/imported/1.png-c9a8e694d0d275633d567702fb508122.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
18
project/assets/Checked.svg
Normal file
18
project/assets/Checked.svg
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<svg width="834" height="500" viewBox="0 0 834 500" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_162_85)">
|
||||||
|
<rect width="833.333" height="500" rx="250" fill="#23A55A"/>
|
||||||
|
<g clip-path="url(#clip1_162_85)">
|
||||||
|
<path d="M791.667 250C791.667 134.941 698.393 41.6666 583.333 41.6666C468.274 41.6666 375 134.941 375 250C375 365.059 468.274 458.333 583.333 458.333C698.393 458.333 791.667 365.059 791.667 250Z" fill="white"/>
|
||||||
|
<path d="M539.491 351.121L506.345 317.977L673.122 151.199L706.268 184.345L539.491 351.121Z" fill="#23A55A"/>
|
||||||
|
<path d="M460.134 272.714L493.279 239.568L571.844 318.133L538.698 351.279L460.134 272.714Z" fill="#23A55A"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0_162_85">
|
||||||
|
<rect width="833.333" height="500" rx="250" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
<clipPath id="clip1_162_85">
|
||||||
|
<rect width="583.333" height="416.667" fill="white" transform="translate(291.667 41.6666)"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 926 B |
37
project/assets/Checked.svg.import
Normal file
37
project/assets/Checked.svg.import
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dnfq6kug4x6o2"
|
||||||
|
path="res://.godot/imported/Checked.svg-f72e721c76a88d84ce4de3fd19f840d5.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/Checked.svg"
|
||||||
|
dest_files=["res://.godot/imported/Checked.svg-f72e721c76a88d84ce4de3fd19f840d5.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
18
project/assets/Unchecked.svg
Normal file
18
project/assets/Unchecked.svg
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<svg width="834" height="500" viewBox="0 0 834 500" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_162_79)">
|
||||||
|
<rect x="0.666687" width="833.333" height="500" rx="250" fill="#80848E"/>
|
||||||
|
<g clip-path="url(#clip1_162_79)">
|
||||||
|
<path d="M459 250C459 134.941 365.726 41.6666 250.667 41.6666C135.607 41.6666 42.3333 134.941 42.3333 250C42.3333 365.059 135.607 458.333 250.667 458.333C365.726 458.333 459 365.059 459 250Z" fill="white"/>
|
||||||
|
<path d="M149.257 181.868L182.402 148.722L351.813 318.134L318.667 351.28L149.257 181.868Z" fill="#80848E"/>
|
||||||
|
<path d="M318.801 148.722L351.946 181.868L182.535 351.28L149.389 318.134L318.801 148.722Z" fill="#80848E"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0_162_79">
|
||||||
|
<rect x="0.666687" width="833.333" height="500" rx="250" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
<clipPath id="clip1_162_79">
|
||||||
|
<rect width="583.333" height="416.667" fill="white" transform="translate(-41 41.6666)"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 942 B |
37
project/assets/Unchecked.svg.import
Normal file
37
project/assets/Unchecked.svg.import
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://compmm3kviqqe"
|
||||||
|
path="res://.godot/imported/Unchecked.svg-766fb74b3cafb9a423726f8edb81f7ad.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/Unchecked.svg"
|
||||||
|
dest_files=["res://.godot/imported/Unchecked.svg-766fb74b3cafb9a423726f8edb81f7ad.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
BIN
project/discord_pfp_cache/invitepfp.png
Normal file
BIN
project/discord_pfp_cache/invitepfp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
34
project/discord_pfp_cache/invitepfp.png.import
Normal file
34
project/discord_pfp_cache/invitepfp.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://lct8hsyc4bx6"
|
||||||
|
path="res://.godot/imported/invitepfp.png-a7b335dc42426751624b97336b7117a8.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://discord_pfp_cache/invitepfp.png"
|
||||||
|
dest_files=["res://.godot/imported/invitepfp.png-a7b335dc42426751624b97336b7117a8.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
@@ -8,7 +8,7 @@ custom_features=""
|
|||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="../../demo/Discord_Activity.exe"
|
export_path="../../demo/discord_sdk.exe"
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
encrypt_pck=false
|
encrypt_pck=false
|
||||||
|
@@ -1,18 +1,93 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
var invite_pfp
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
Discord_Activity.app_id = 1099618430065324082
|
set_activity()
|
||||||
Discord_Activity.details = "A demo activity by vaporvee#1231"
|
discord_sdk.connect("activity_join_request",_on_activity_join_request)
|
||||||
Discord_Activity.state = "Checkpoint 23/23"
|
discord_sdk.connect("activity_join",_on_activity_join)
|
||||||
|
discord_sdk.connect("activity_spectate",_on_activity_spectate)
|
||||||
|
download_texture("https://cdn.discordapp.com/embed/avatars/1.png", "res://discord_pfp_cache/invitepfp.png")
|
||||||
|
debug_text_update()
|
||||||
|
func download_texture(url, file_name):
|
||||||
|
$user_request_avatar/HTTPRequest.download_file = file_name
|
||||||
|
invite_pfp = file_name
|
||||||
|
$user_request_avatar/HTTPRequest.request(url)
|
||||||
|
|
||||||
Discord_Activity.large_image = "game"
|
func _on_http_request_request_completed(_result, _response_code, _headers, _body):
|
||||||
Discord_Activity.large_image_text = "Try it now!"
|
var image = Image.new()
|
||||||
Discord_Activity.small_image = "boss"
|
image.load(str(invite_pfp))
|
||||||
Discord_Activity.small_image_text = "Fighting the end boss! D:"
|
var texture = ImageTexture.create_from_image(image)
|
||||||
|
$user_request_avatar.texture = texture
|
||||||
|
|
||||||
#Discord_Activity.start_timestamp = int(Time.get_unix_time_from_system())
|
func set_activity():
|
||||||
Discord_Activity.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
|
discord_sdk.app_id = 1099618430065324082
|
||||||
|
discord_sdk.details = "A demo activity by vaporvee#1231"
|
||||||
|
discord_sdk.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
|
||||||
|
|
||||||
|
# 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 = 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("steam://rungameid/1389990")
|
||||||
|
#discord_sdk.register_steam(1389990)
|
||||||
|
discord_sdk.refresh()
|
||||||
|
|
||||||
Discord_Activity.refresh()
|
func debug_text_update():
|
||||||
|
$Info.text = $Info.text.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("{discordinfo}",str(discord_sdk.get_is_discord_working())).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))
|
||||||
|
|
||||||
$Info.text = $Info.text.replace("{discordinfo}",str(Discord_Activity.get_is_discord_working())).replace("{id}",str(Discord_Activity.app_id)).replace("{details}",Discord_Activity.details).replace("{state}",Discord_Activity.state).replace("{lkey}",Discord_Activity.large_image).replace("{ltext}",Discord_Activity.large_image_text).replace("{skey}",Discord_Activity.small_image).replace("{stext}",Discord_Activity.small_image_text).replace("{stimestamp}",str(Discord_Activity.start_timestamp)).replace("{etimestamp}",str(Discord_Activity.end_timestamp))
|
var user_request = {};
|
||||||
|
|
||||||
|
func _on_activity_join_request(user_requesting):
|
||||||
|
print(user_requesting)
|
||||||
|
user_request = user_requesting
|
||||||
|
print(user_requesting.avatar_url)
|
||||||
|
download_texture(user_requesting.avatar_url, "res://discord_pfp_cache/invitepfp.png")
|
||||||
|
|
||||||
|
func _on_activity_join(secret):
|
||||||
|
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()
|
||||||
|
$Info.text = $Info.text.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("{discordinfo}",str(discord_sdk.get_is_discord_working())).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))
|
||||||
|
debug_text_update()
|
||||||
|
|
||||||
|
func _on_activity_spectate(secret):
|
||||||
|
print(secret)
|
||||||
|
|
||||||
|
func _on_check_button_toggled(button_pressed):
|
||||||
|
if(button_pressed):
|
||||||
|
set_activity()
|
||||||
|
else:
|
||||||
|
discord_sdk.clear()
|
||||||
|
|
||||||
|
func _on_button_pressed():
|
||||||
|
if(!user_request.is_empty()):
|
||||||
|
discord_sdk.accept_join_request(user_request.id)
|
||||||
|
|
||||||
|
func _on_line_edit_text_submitted(new_text):
|
||||||
|
discord_sdk.send_invite(int(new_text),true,"this is a test invite sent from godot")
|
||||||
|
print(int(new_text))
|
||||||
|
|
||||||
|
|
||||||
|
func _on_line_edit_2_text_submitted(new_text):
|
||||||
|
discord_sdk.accept_invite(int(new_text))
|
||||||
|
print(int(new_text))
|
||||||
|
@@ -1,7 +1,12 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://dmx2xuigcpvt4"]
|
[gd_scene load_steps=7 format=3 uid="uid://dmx2xuigcpvt4"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://main.gd" id="1_kl8ri"]
|
[ext_resource type="Script" path="res://main.gd" id="1_kl8ri"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dhuttdaet6q1u" path="res://assets/Logo_V2_Clyde.png" id="2_1hv5q"]
|
[ext_resource type="Texture2D" uid="uid://dhuttdaet6q1u" path="res://assets/Logo_V2_Clyde.png" id="2_1hv5q"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dnfq6kug4x6o2" path="res://assets/Checked.svg" id="3_ny5eu"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://compmm3kviqqe" path="res://assets/Unchecked.svg" id="4_xydmq"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ht210p8vs8s7" path="res://assets/1.png" id="5_06yyg"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1w3f4"]
|
||||||
|
|
||||||
[node name="Node" type="Node"]
|
[node name="Node" type="Node"]
|
||||||
script = ExtResource("1_kl8ri")
|
script = ExtResource("1_kl8ri")
|
||||||
@@ -18,20 +23,20 @@ color = Color(0.345098, 0.396078, 0.94902, 1)
|
|||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
texture_filter = 4
|
texture_filter = 4
|
||||||
position = Vector2(565, 308)
|
position = Vector2(580, 308)
|
||||||
scale = Vector2(0.408203, 0.408203)
|
scale = Vector2(0.408203, 0.408203)
|
||||||
texture = ExtResource("2_1hv5q")
|
texture = ExtResource("2_1hv5q")
|
||||||
|
|
||||||
[node name="DiscordSDK Test" type="RichTextLabel" parent="."]
|
[node name="DiscordSDK Test" type="RichTextLabel" parent="."]
|
||||||
anchors_preset = 8
|
anchors_preset = -1
|
||||||
anchor_left = 0.5
|
anchor_left = 0.293
|
||||||
anchor_top = 0.5
|
anchor_top = 0.59
|
||||||
anchor_right = 0.5
|
anchor_right = 0.736
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.727
|
||||||
offset_left = -257.0
|
offset_left = -0.536011
|
||||||
offset_top = 54.0
|
offset_top = -0.319977
|
||||||
offset_right = 257.0
|
offset_right = 0.12793
|
||||||
offset_bottom = 150.0
|
offset_bottom = -0.0960388
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
@@ -44,8 +49,8 @@ text = "[center][font s=60][rainbow]DiscordSDK Test[/rainbow][/font]"
|
|||||||
[node name="Info" type="RichTextLabel" parent="."]
|
[node name="Info" type="RichTextLabel" parent="."]
|
||||||
offset_left = 7.0
|
offset_left = 7.0
|
||||||
offset_top = 6.0
|
offset_top = 6.0
|
||||||
offset_right = 514.0
|
offset_right = 424.0
|
||||||
offset_bottom = 722.0
|
offset_bottom = 312.0
|
||||||
text = "Discord working: {discordinfo}
|
text = "Discord working: {discordinfo}
|
||||||
|
|
||||||
Application ID : {id}
|
Application ID : {id}
|
||||||
@@ -58,5 +63,83 @@ Small image key: {skey}
|
|||||||
Small image text: {stext}
|
Small image text: {stext}
|
||||||
|
|
||||||
Start timestamp: {stimestamp}
|
Start timestamp: {stimestamp}
|
||||||
End timestamp: {etimestamp}"
|
End timestamp: {etimestamp}
|
||||||
scroll_active = false
|
|
||||||
|
Party ID: {partyid}
|
||||||
|
Current party size: {cpartysize}
|
||||||
|
Max party size: {mpartysize}
|
||||||
|
Match secret: {msecret}
|
||||||
|
Join secret: {jsecret}
|
||||||
|
Spectate secret: {ssecret}"
|
||||||
|
|
||||||
|
[node name="CheckButton" type="CheckButton" parent="."]
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_left = 0.484
|
||||||
|
anchor_top = 0.781
|
||||||
|
anchor_right = 0.521
|
||||||
|
anchor_bottom = 0.82
|
||||||
|
offset_left = 0.431946
|
||||||
|
offset_top = -0.0880127
|
||||||
|
offset_right = 803.808
|
||||||
|
offset_bottom = 482.64
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
scale = Vector2(0.05, 0.05)
|
||||||
|
theme_override_icons/checked = ExtResource("3_ny5eu")
|
||||||
|
theme_override_icons/unchecked = ExtResource("4_xydmq")
|
||||||
|
theme_override_styles/focus = SubResource("StyleBoxEmpty_1w3f4")
|
||||||
|
button_pressed = true
|
||||||
|
|
||||||
|
[node name="user_request_avatar" type="Sprite2D" parent="."]
|
||||||
|
position = Vector2(662, 559)
|
||||||
|
scale = Vector2(0.152344, 0.152344)
|
||||||
|
texture = ExtResource("5_06yyg")
|
||||||
|
|
||||||
|
[node name="HTTPRequest" type="HTTPRequest" parent="user_request_avatar"]
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="."]
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_left = 0.437
|
||||||
|
anchor_top = 0.844
|
||||||
|
anchor_right = 0.562
|
||||||
|
anchor_bottom = 0.892
|
||||||
|
offset_left = 0.575989
|
||||||
|
offset_top = 0.0879517
|
||||||
|
offset_right = -1.42395
|
||||||
|
offset_bottom = -0.0159912
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
text = "ACCEPT REQUEST"
|
||||||
|
|
||||||
|
[node name="LineEdit" type="LineEdit" parent="."]
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_left = 0.416
|
||||||
|
anchor_top = 0.904
|
||||||
|
anchor_right = 0.584
|
||||||
|
anchor_bottom = 0.952
|
||||||
|
offset_left = 0.268005
|
||||||
|
offset_top = 0.207947
|
||||||
|
offset_right = -0.268066
|
||||||
|
offset_bottom = 0.104004
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
placeholder_text = "Invite with user_id here"
|
||||||
|
|
||||||
|
[node name="LineEdit2" type="LineEdit" parent="."]
|
||||||
|
anchors_preset = 7
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -124.0
|
||||||
|
offset_top = -31.0
|
||||||
|
offset_right = 125.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
placeholder_text = "Accept Invite with user_id here"
|
||||||
|
|
||||||
|
[connection signal="toggled" from="CheckButton" to="." method="_on_check_button_toggled"]
|
||||||
|
[connection signal="request_completed" from="user_request_avatar/HTTPRequest" to="." method="_on_http_request_request_completed"]
|
||||||
|
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||||
|
[connection signal="text_submitted" from="LineEdit" to="." method="_on_line_edit_text_submitted"]
|
||||||
|
[connection signal="text_submitted" from="LineEdit2" to="." method="_on_line_edit_2_text_submitted"]
|
||||||
|
@@ -22,6 +22,10 @@ config/icon="res://assets/Logo_V2.png"
|
|||||||
|
|
||||||
updater_discordsdk="*res://addons/discord-sdk-gd/sdk_utility.gd"
|
updater_discordsdk="*res://addons/discord-sdk-gd/sdk_utility.gd"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/resizable=false
|
||||||
|
|
||||||
[dotnet]
|
[dotnet]
|
||||||
|
|
||||||
project/assembly_name="GDExtension Test Project"
|
project/assembly_name="GDExtension Test Project"
|
||||||
|
@@ -7,80 +7,124 @@
|
|||||||
|
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
Discord_Activity *Discord_Activity::singleton = nullptr;
|
discord_sdk *discord_sdk::singleton = nullptr;
|
||||||
|
|
||||||
discord::Core *core{};
|
discord::Core *core{};
|
||||||
discord::Result result;
|
discord::Result result;
|
||||||
discord::Activity activity{};
|
discord::Activity activity{};
|
||||||
discord::User user{};
|
discord::User user{};
|
||||||
|
|
||||||
void Discord_Activity::_bind_methods()
|
void discord_sdk::_bind_methods()
|
||||||
{
|
{
|
||||||
ClassDB::bind_method(D_METHOD("debug"), &Discord_Activity::debug);
|
ClassDB::bind_method(D_METHOD("debug"), &discord_sdk::debug);
|
||||||
ClassDB::bind_method(D_METHOD("coreupdate"), &Discord_Activity::coreupdate);
|
ClassDB::bind_method(D_METHOD("coreupdate"), &discord_sdk::coreupdate);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_app_id"), &Discord_Activity::get_app_id);
|
ClassDB::bind_method(D_METHOD("get_app_id"), &discord_sdk::get_app_id);
|
||||||
ClassDB::bind_method(D_METHOD("set_app_id", "app_id"), &Discord_Activity::set_app_id);
|
ClassDB::bind_method(D_METHOD("set_app_id", "app_id"), &discord_sdk::set_app_id);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "app_id"), "set_app_id", "get_app_id");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "app_id"), "set_app_id", "get_app_id");
|
||||||
ClassDB::bind_method(D_METHOD("get_state"), &Discord_Activity::get_state);
|
ClassDB::bind_method(D_METHOD("get_state"), &discord_sdk::get_state);
|
||||||
ClassDB::bind_method(D_METHOD("set_state", "state"), &Discord_Activity::set_state);
|
ClassDB::bind_method(D_METHOD("set_state", "state"), &discord_sdk::set_state);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "state"), "set_state", "get_state");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "state"), "set_state", "get_state");
|
||||||
ClassDB::bind_method(D_METHOD("get_details"), &Discord_Activity::get_details);
|
ClassDB::bind_method(D_METHOD("get_details"), &discord_sdk::get_details);
|
||||||
ClassDB::bind_method(D_METHOD("set_details", "details"), &Discord_Activity::set_details);
|
ClassDB::bind_method(D_METHOD("set_details", "details"), &discord_sdk::set_details);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "details"), "set_details", "get_details");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "details"), "set_details", "get_details");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_large_image"), &Discord_Activity::get_large_image);
|
ClassDB::bind_method(D_METHOD("get_large_image"), &discord_sdk::get_large_image);
|
||||||
ClassDB::bind_method(D_METHOD("set_large_image", "large_image"), &Discord_Activity::set_large_image);
|
ClassDB::bind_method(D_METHOD("set_large_image", "large_image"), &discord_sdk::set_large_image);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "large_image"), "set_large_image", "get_large_image");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "large_image"), "set_large_image", "get_large_image");
|
||||||
ClassDB::bind_method(D_METHOD("get_large_image_text"), &Discord_Activity::get_large_image_text);
|
ClassDB::bind_method(D_METHOD("get_large_image_text"), &discord_sdk::get_large_image_text);
|
||||||
ClassDB::bind_method(D_METHOD("set_large_image_text", "large_image_text"), &Discord_Activity::set_large_image_text);
|
ClassDB::bind_method(D_METHOD("set_large_image_text", "large_image_text"), &discord_sdk::set_large_image_text);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "large_image_text"), "set_large_image_text", "get_large_image_text");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "large_image_text"), "set_large_image_text", "get_large_image_text");
|
||||||
ClassDB::bind_method(D_METHOD("get_small_image"), &Discord_Activity::get_small_image);
|
ClassDB::bind_method(D_METHOD("get_small_image"), &discord_sdk::get_small_image);
|
||||||
ClassDB::bind_method(D_METHOD("set_small_image", "small_image"), &Discord_Activity::set_small_image);
|
ClassDB::bind_method(D_METHOD("set_small_image", "small_image"), &discord_sdk::set_small_image);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "small_image"), "set_small_image", "get_small_image");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "small_image"), "set_small_image", "get_small_image");
|
||||||
ClassDB::bind_method(D_METHOD("get_small_image_text"), &Discord_Activity::get_small_image_text);
|
ClassDB::bind_method(D_METHOD("get_small_image_text"), &discord_sdk::get_small_image_text);
|
||||||
ClassDB::bind_method(D_METHOD("set_small_image_text", "large_small_text"), &Discord_Activity::set_small_image_text);
|
ClassDB::bind_method(D_METHOD("set_small_image_text", "large_small_text"), &discord_sdk::set_small_image_text);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "small_image_text"), "set_small_image_text", "get_small_image_text");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "small_image_text"), "set_small_image_text", "get_small_image_text");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_start_timestamp"), &Discord_Activity::get_start_timestamp);
|
ClassDB::bind_method(D_METHOD("get_start_timestamp"), &discord_sdk::get_start_timestamp);
|
||||||
ClassDB::bind_method(D_METHOD("set_start_timestamp", "start_timestamp"), &Discord_Activity::set_start_timestamp);
|
ClassDB::bind_method(D_METHOD("set_start_timestamp", "start_timestamp"), &discord_sdk::set_start_timestamp);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "start_timestamp"), "set_start_timestamp", "get_start_timestamp");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "start_timestamp"), "set_start_timestamp", "get_start_timestamp");
|
||||||
ClassDB::bind_method(D_METHOD("get_end_timestamp"), &Discord_Activity::get_end_timestamp);
|
ClassDB::bind_method(D_METHOD("get_end_timestamp"), &discord_sdk::get_end_timestamp);
|
||||||
ClassDB::bind_method(D_METHOD("set_end_timestamp", "end_timestamp"), &Discord_Activity::set_end_timestamp);
|
ClassDB::bind_method(D_METHOD("set_end_timestamp", "end_timestamp"), &discord_sdk::set_end_timestamp);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "end_timestamp"), "set_end_timestamp", "get_end_timestamp");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "end_timestamp"), "set_end_timestamp", "get_end_timestamp");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("refresh"), &Discord_Activity::refresh);
|
ClassDB::bind_method(D_METHOD("get_party_id"), &discord_sdk::get_party_id);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_is_discord_working"), &Discord_Activity::get_is_discord_working);
|
ClassDB::bind_method(D_METHOD("set_party_id", "party_id"), &discord_sdk::set_party_id);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "party_id"), "set_party_id", "get_party_id");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_result_int"), &Discord_Activity::get_result_int);
|
ClassDB::bind_method(D_METHOD("get_current_party_size"), &discord_sdk::get_current_party_size);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_current_party_size", "current_party_size"), &discord_sdk::set_current_party_size);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_party_size"), "set_current_party_size", "get_current_party_size");
|
||||||
|
ClassDB::bind_method(D_METHOD("get_max_party_size"), &discord_sdk::get_max_party_size);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_max_party_size", "max_party_size"), &discord_sdk::set_max_party_size);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_party_size"), "set_max_party_size", "get_max_party_size");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_match_secret"), &discord_sdk::get_match_secret);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_match_secret", "match_secret"), &discord_sdk::set_match_secret);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "match_secret"), "set_match_secret", "get_match_secret");
|
||||||
|
ClassDB::bind_method(D_METHOD("get_join_secret"), &discord_sdk::get_join_secret);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_join_secret", "join_secret"), &discord_sdk::set_join_secret);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "join_secret"), "set_join_secret", "get_join_secret");
|
||||||
|
ClassDB::bind_method(D_METHOD("get_spectate_secret"), &discord_sdk::get_spectate_secret);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_spectate_secret", "spectate_secret"), &discord_sdk::set_spectate_secret);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "spectate_secret"), "set_spectate_secret", "get_spectate_secret");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_instanced"), &discord_sdk::get_instanced);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_instanced", "instanced"), &discord_sdk::set_instanced);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "instanced"), "set_instanced", "get_instanced");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_is_public_party"), &discord_sdk::get_is_public_party);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_is_public_party", "is_public_party"), &discord_sdk::set_is_public_party);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_public_party"), "set_is_public_party", "get_is_public_party");
|
||||||
|
|
||||||
|
ADD_SIGNAL(MethodInfo("activity_join", PropertyInfo(Variant::STRING, "join_secret")));
|
||||||
|
ADD_SIGNAL(MethodInfo("activity_spectate", PropertyInfo(Variant::STRING, "spectate_secret")));
|
||||||
|
ADD_SIGNAL(MethodInfo("activity_join_request", PropertyInfo(Variant::DICTIONARY, "user_requesting")));
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("refresh"), &discord_sdk::refresh);
|
||||||
|
ClassDB::bind_method(D_METHOD("clear"), &discord_sdk::clear);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("register_command", "command"), &discord_sdk::register_command);
|
||||||
|
ClassDB::bind_method(D_METHOD("register_steam", "steam_id"), &discord_sdk::register_steam);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("accept_join_request", "user_id"), &discord_sdk::accept_join_request);
|
||||||
|
ClassDB::bind_method(D_METHOD("send_invite", "user_id", "is_spectate", "message_content"), &discord_sdk::send_invite);
|
||||||
|
ClassDB::bind_method(D_METHOD("accept_invite", "user_id"), &discord_sdk::accept_invite);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_is_discord_working"), &discord_sdk::get_is_discord_working);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_result_int"), &discord_sdk::get_result_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
Discord_Activity *Discord_Activity::get_singleton()
|
discord_sdk *discord_sdk::get_singleton()
|
||||||
{
|
{
|
||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
Discord_Activity::Discord_Activity()
|
discord_sdk::discord_sdk()
|
||||||
{
|
{
|
||||||
ERR_FAIL_COND(singleton != nullptr);
|
ERR_FAIL_COND(singleton != nullptr);
|
||||||
singleton = this;
|
singleton = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Discord_Activity::~Discord_Activity()
|
discord_sdk::~discord_sdk()
|
||||||
{
|
{
|
||||||
ERR_FAIL_COND(singleton != this);
|
ERR_FAIL_COND(singleton != this);
|
||||||
singleton = nullptr;
|
singleton = nullptr;
|
||||||
|
delete core;
|
||||||
|
core = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Discord_Activity::coreupdate()
|
void discord_sdk::coreupdate()
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
{
|
{
|
||||||
::core->RunCallbacks();
|
::core->RunCallbacks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Discord_Activity::debug()
|
void discord_sdk::debug()
|
||||||
{
|
{
|
||||||
result = discord::Core::Create(1080224638845591692, DiscordCreateFlags_NoRequireDiscord, &core);
|
result = discord::Core::Create(1080224638845591692, DiscordCreateFlags_NoRequireDiscord, &core);
|
||||||
activity.SetState("Test from Godot!");
|
activity.SetState("Test from Godot!");
|
||||||
@@ -93,116 +137,270 @@ void Discord_Activity::debug()
|
|||||||
if (result == discord::Result::Ok)
|
if (result == discord::Result::Ok)
|
||||||
{
|
{
|
||||||
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||||
core->UserManager().OnCurrentUserUpdate.Connect([]()
|
|
||||||
{ core->UserManager().GetCurrentUser(&user); });
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
|
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Discord_Activity::set_app_id(int64_t value)
|
void discord_sdk::set_app_id(int64_t value)
|
||||||
{
|
{
|
||||||
app_id = value;
|
app_id = value;
|
||||||
result = discord::Core::Create(value, DiscordCreateFlags_NoRequireDiscord, &core);
|
result = discord::Core::Create(value, DiscordCreateFlags_NoRequireDiscord, &core); // after setting app_ID it initializes everything
|
||||||
|
|
||||||
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
|
{
|
||||||
|
// signals
|
||||||
|
core->ActivityManager().OnActivityJoin.Connect([](const char *secret)
|
||||||
|
{ discord_sdk::get_singleton()
|
||||||
|
->emit_signal("activity_join", secret); });
|
||||||
|
core->ActivityManager().OnActivitySpectate.Connect([](const char *secret)
|
||||||
|
{ discord_sdk::get_singleton()
|
||||||
|
->emit_signal("activity_spectate", secret); });
|
||||||
|
core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user)
|
||||||
|
{ Dictionary user_requesting;
|
||||||
|
user_requesting["avatar"] = user.GetAvatar(); //can be empty when user has no avatar
|
||||||
|
user_requesting["is_bot"] = user.GetBot();
|
||||||
|
user_requesting["discriminator"] = user.GetDiscriminator();
|
||||||
|
user_requesting["id"] = user.GetId();
|
||||||
|
user_requesting["username"] = user.GetUsername();
|
||||||
|
if(String(user_requesting["avatar"]).is_empty())
|
||||||
|
user_requesting["avatar_url"] = String(std::string("https://cdn.discordapp.com/embed/avatars/" + std::to_string((user_requesting["discriminator"].INT % 5) - 1)+ ".png").c_str());
|
||||||
|
else
|
||||||
|
user_requesting["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png?size=512").c_str());
|
||||||
|
user_requesting.make_read_only();
|
||||||
|
discord_sdk::get_singleton()
|
||||||
|
->emit_signal("activity_join_request",user_requesting); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int64_t Discord_Activity::get_app_id()
|
int64_t discord_sdk::get_app_id()
|
||||||
{
|
{
|
||||||
return app_id;
|
return app_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Discord_Activity::set_state(String value)
|
void discord_sdk::set_state(String value)
|
||||||
{
|
{
|
||||||
state = value;
|
state = value;
|
||||||
activity.SetState(value.utf8().get_data());
|
activity.SetState(value.utf8().get_data());
|
||||||
}
|
}
|
||||||
String Discord_Activity::get_state()
|
String discord_sdk::get_state()
|
||||||
{
|
{
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
void Discord_Activity::set_details(String value)
|
void discord_sdk::set_details(String value)
|
||||||
{
|
{
|
||||||
details = value;
|
details = value;
|
||||||
activity.SetDetails(value.utf8().get_data());
|
activity.SetDetails(value.utf8().get_data());
|
||||||
}
|
}
|
||||||
String Discord_Activity::get_details()
|
String discord_sdk::get_details()
|
||||||
{
|
{
|
||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Discord_Activity::refresh()
|
void discord_sdk::refresh()
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
{
|
{
|
||||||
|
activity.GetParty().SetPrivacy(discord::ActivityPartyPrivacy::Public);
|
||||||
|
activity.SetType(discord::ActivityType::Playing);
|
||||||
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||||
core->UserManager().OnCurrentUserUpdate.Connect([]()
|
|
||||||
{ core->UserManager().GetCurrentUser(&user); });
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
|
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Discord_Activity::set_large_image(String value)
|
void discord_sdk::clear()
|
||||||
|
{
|
||||||
|
if (result == discord::Result::Ok)
|
||||||
|
{
|
||||||
|
app_id = 0;
|
||||||
|
state = "";
|
||||||
|
details = "";
|
||||||
|
large_image = "";
|
||||||
|
large_image_text = "";
|
||||||
|
small_image = "";
|
||||||
|
small_image_text = "";
|
||||||
|
start_timestamp = 0;
|
||||||
|
end_timestamp = 0;
|
||||||
|
party_id = "-";
|
||||||
|
current_party_size = 0;
|
||||||
|
max_party_size = 0;
|
||||||
|
match_secret = "";
|
||||||
|
join_secret = "";
|
||||||
|
spectate_secret = "";
|
||||||
|
instanced = false;
|
||||||
|
|
||||||
|
delete core;
|
||||||
|
core = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void discord_sdk::set_large_image(String value)
|
||||||
{
|
{
|
||||||
large_image = value;
|
large_image = value;
|
||||||
activity.GetAssets().SetLargeImage(value.utf8().get_data());
|
activity.GetAssets().SetLargeImage(value.utf8().get_data());
|
||||||
}
|
}
|
||||||
String Discord_Activity::get_large_image()
|
String discord_sdk::get_large_image()
|
||||||
{
|
{
|
||||||
return large_image;
|
return large_image;
|
||||||
}
|
}
|
||||||
void Discord_Activity::set_large_image_text(String value)
|
void discord_sdk::set_large_image_text(String value)
|
||||||
{
|
{
|
||||||
large_image_text = value;
|
large_image_text = value;
|
||||||
activity.GetAssets().SetLargeText(value.utf8().get_data());
|
activity.GetAssets().SetLargeText(value.utf8().get_data());
|
||||||
}
|
}
|
||||||
String Discord_Activity::get_large_image_text()
|
String discord_sdk::get_large_image_text()
|
||||||
{
|
{
|
||||||
return large_image_text;
|
return large_image_text;
|
||||||
}
|
}
|
||||||
void Discord_Activity::set_small_image(String value)
|
void discord_sdk::set_small_image(String value)
|
||||||
{
|
{
|
||||||
small_image = value;
|
small_image = value;
|
||||||
activity.GetAssets().SetSmallImage(value.utf8().get_data());
|
activity.GetAssets().SetSmallImage(value.utf8().get_data());
|
||||||
}
|
}
|
||||||
String Discord_Activity::get_small_image()
|
String discord_sdk::get_small_image()
|
||||||
{
|
{
|
||||||
return small_image;
|
return small_image;
|
||||||
}
|
}
|
||||||
void Discord_Activity::set_small_image_text(String value)
|
void discord_sdk::set_small_image_text(String value)
|
||||||
{
|
{
|
||||||
small_image_text = value;
|
small_image_text = value;
|
||||||
activity.GetAssets().SetSmallText(value.utf8().get_data());
|
activity.GetAssets().SetSmallText(value.utf8().get_data());
|
||||||
}
|
}
|
||||||
String Discord_Activity::get_small_image_text()
|
String discord_sdk::get_small_image_text()
|
||||||
{
|
{
|
||||||
return small_image_text;
|
return small_image_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Discord_Activity::set_start_timestamp(int64_t value)
|
void discord_sdk::set_start_timestamp(int64_t value)
|
||||||
{
|
{
|
||||||
start_timestamp = value;
|
start_timestamp = value;
|
||||||
activity.GetTimestamps().SetStart(value);
|
activity.GetTimestamps().SetStart(value);
|
||||||
}
|
}
|
||||||
int64_t Discord_Activity::get_start_timestamp()
|
int64_t discord_sdk::get_start_timestamp()
|
||||||
{
|
{
|
||||||
return activity.GetTimestamps().GetStart();
|
return activity.GetTimestamps().GetStart();
|
||||||
}
|
}
|
||||||
void Discord_Activity::set_end_timestamp(int64_t value)
|
void discord_sdk::set_end_timestamp(int64_t value)
|
||||||
{
|
{
|
||||||
end_timestamp = value;
|
end_timestamp = value;
|
||||||
activity.GetTimestamps().SetEnd(value);
|
activity.GetTimestamps().SetEnd(value);
|
||||||
}
|
}
|
||||||
int64_t Discord_Activity::get_end_timestamp()
|
int64_t discord_sdk::get_end_timestamp()
|
||||||
{
|
{
|
||||||
return activity.GetTimestamps().GetEnd();
|
return activity.GetTimestamps().GetEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Discord_Activity::get_is_discord_working()
|
void discord_sdk::set_party_id(String value)
|
||||||
|
{
|
||||||
|
party_id = value;
|
||||||
|
activity.GetParty().SetId(value.utf8().get_data());
|
||||||
|
}
|
||||||
|
String discord_sdk::get_party_id()
|
||||||
|
{
|
||||||
|
return party_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void discord_sdk::set_current_party_size(int32_t value)
|
||||||
|
{
|
||||||
|
current_party_size = value;
|
||||||
|
activity.GetParty().GetSize().SetCurrentSize(value);
|
||||||
|
}
|
||||||
|
int32_t discord_sdk::get_current_party_size()
|
||||||
|
{
|
||||||
|
return current_party_size;
|
||||||
|
}
|
||||||
|
void discord_sdk::set_max_party_size(int32_t value)
|
||||||
|
{
|
||||||
|
max_party_size = value;
|
||||||
|
activity.GetParty().GetSize().SetMaxSize(value);
|
||||||
|
}
|
||||||
|
int32_t discord_sdk::get_max_party_size()
|
||||||
|
{
|
||||||
|
return max_party_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void discord_sdk::set_match_secret(String value)
|
||||||
|
{
|
||||||
|
match_secret = value;
|
||||||
|
activity.GetSecrets().SetMatch(value.utf8().get_data());
|
||||||
|
}
|
||||||
|
String discord_sdk::get_match_secret()
|
||||||
|
{
|
||||||
|
return match_secret;
|
||||||
|
}
|
||||||
|
void discord_sdk::set_join_secret(String value)
|
||||||
|
{
|
||||||
|
join_secret = value;
|
||||||
|
activity.GetSecrets().SetJoin(value.utf8().get_data());
|
||||||
|
}
|
||||||
|
String discord_sdk::get_join_secret()
|
||||||
|
{
|
||||||
|
return join_secret;
|
||||||
|
}
|
||||||
|
void discord_sdk::set_spectate_secret(String value)
|
||||||
|
{
|
||||||
|
spectate_secret = value;
|
||||||
|
activity.GetSecrets().SetSpectate(value.utf8().get_data());
|
||||||
|
}
|
||||||
|
String discord_sdk::get_spectate_secret()
|
||||||
|
{
|
||||||
|
return spectate_secret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void discord_sdk::set_instanced(bool value)
|
||||||
|
{
|
||||||
|
instanced = value;
|
||||||
|
activity.SetInstance(value);
|
||||||
|
}
|
||||||
|
bool discord_sdk::get_instanced()
|
||||||
|
{
|
||||||
|
return instanced;
|
||||||
|
}
|
||||||
|
|
||||||
|
void discord_sdk::set_is_public_party(bool value)
|
||||||
|
{
|
||||||
|
is_public_party = value;
|
||||||
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
|
activity.GetParty().SetPrivacy(static_cast<discord::ActivityPartyPrivacy>(value)); // normaly true
|
||||||
|
}
|
||||||
|
bool discord_sdk::get_is_public_party()
|
||||||
|
{
|
||||||
|
return is_public_party;
|
||||||
|
}
|
||||||
|
|
||||||
|
void discord_sdk::accept_join_request(int64_t user_id)
|
||||||
|
{
|
||||||
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
|
core->ActivityManager().SendRequestReply(user_id, static_cast<discord::ActivityJoinRequestReply>(1), {});
|
||||||
|
}
|
||||||
|
void discord_sdk::send_invite(int64_t user_id, bool is_spectate = false, String message_content = "")
|
||||||
|
{
|
||||||
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
|
core->ActivityManager().SendInvite(user_id, static_cast<discord::ActivityActionType>(is_spectate + 1), message_content.utf8().get_data(), {});
|
||||||
|
}
|
||||||
|
void discord_sdk::accept_invite(int64_t user_id)
|
||||||
|
{
|
||||||
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
|
core->ActivityManager().AcceptInvite(user_id, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
void discord_sdk::register_command(String value)
|
||||||
|
{
|
||||||
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
|
core->ActivityManager().RegisterCommand(value.utf8().get_data());
|
||||||
|
}
|
||||||
|
void discord_sdk::register_steam(int32_t value)
|
||||||
|
{
|
||||||
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
|
core->ActivityManager().RegisterSteam(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool discord_sdk::get_is_discord_working()
|
||||||
{
|
{
|
||||||
return result == discord::Result::Ok && app_id > 0;
|
return result == discord::Result::Ok && app_id > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Discord_Activity::get_result_int()
|
int discord_sdk::get_result_int()
|
||||||
{
|
{
|
||||||
return static_cast<int>(result);
|
return static_cast<int>(result);
|
||||||
}
|
}
|
||||||
|
@@ -3,16 +3,16 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "lib/discord_game_sdk/cpp/discord.h"
|
#include "lib/discord_game_sdk/cpp/discord.h"
|
||||||
#include <godot_cpp/classes/object.hpp>
|
#include <godot_cpp/classes/ref_counted.hpp>
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
class Discord_Activity : public Object
|
class discord_sdk : public RefCounted
|
||||||
{
|
{
|
||||||
GDCLASS(Discord_Activity, Object);
|
GDCLASS(discord_sdk, Object);
|
||||||
|
|
||||||
static Discord_Activity *singleton;
|
static discord_sdk *singleton;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@@ -31,18 +31,30 @@ private:
|
|||||||
int64_t start_timestamp;
|
int64_t start_timestamp;
|
||||||
int64_t end_timestamp;
|
int64_t end_timestamp;
|
||||||
|
|
||||||
public:
|
String party_id;
|
||||||
static Discord_Activity *get_singleton();
|
int32_t current_party_size;
|
||||||
|
int32_t max_party_size;
|
||||||
|
String match_secret;
|
||||||
|
String join_secret;
|
||||||
|
String spectate_secret;
|
||||||
|
|
||||||
Discord_Activity();
|
bool is_public_party = true;
|
||||||
~Discord_Activity();
|
|
||||||
|
bool instanced;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static discord_sdk *
|
||||||
|
get_singleton();
|
||||||
|
|
||||||
|
discord_sdk();
|
||||||
|
~discord_sdk();
|
||||||
|
|
||||||
void debug();
|
void debug();
|
||||||
void coreupdate();
|
void coreupdate();
|
||||||
void refresh();
|
void refresh();
|
||||||
|
void clear();
|
||||||
|
|
||||||
int64_t get_app_id();
|
int64_t get_app_id();
|
||||||
|
|
||||||
void set_app_id(int64_t value);
|
void set_app_id(int64_t value);
|
||||||
String get_state();
|
String get_state();
|
||||||
void set_state(String value);
|
void set_state(String value);
|
||||||
@@ -63,6 +75,33 @@ public:
|
|||||||
int64_t get_end_timestamp();
|
int64_t get_end_timestamp();
|
||||||
void set_end_timestamp(int64_t value);
|
void set_end_timestamp(int64_t value);
|
||||||
|
|
||||||
|
String get_party_id();
|
||||||
|
void set_party_id(String value);
|
||||||
|
|
||||||
|
int32_t get_current_party_size();
|
||||||
|
void set_current_party_size(int32_t value);
|
||||||
|
int32_t get_max_party_size();
|
||||||
|
void set_max_party_size(int32_t value);
|
||||||
|
String get_match_secret();
|
||||||
|
void set_match_secret(String value);
|
||||||
|
String get_join_secret();
|
||||||
|
void set_join_secret(String value);
|
||||||
|
String get_spectate_secret();
|
||||||
|
void set_spectate_secret(String value);
|
||||||
|
|
||||||
|
bool get_is_public_party();
|
||||||
|
void set_is_public_party(bool value);
|
||||||
|
|
||||||
|
bool get_instanced();
|
||||||
|
void set_instanced(bool value);
|
||||||
|
|
||||||
|
void accept_join_request(int64_t user_id);
|
||||||
|
void send_invite(int64_t user_id, bool is_spectate, String message_content);
|
||||||
|
void accept_invite(int64_t user_id);
|
||||||
|
|
||||||
|
void register_command(String value);
|
||||||
|
void register_steam(int32_t value);
|
||||||
|
|
||||||
bool get_is_discord_working();
|
bool get_is_discord_working();
|
||||||
int get_result_int();
|
int get_result_int();
|
||||||
};
|
};
|
||||||
|
@@ -9,15 +9,15 @@
|
|||||||
#include "discordgodot.h"
|
#include "discordgodot.h"
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
static Discord_Activity *discordsdk;
|
static discord_sdk *discordsdk;
|
||||||
|
|
||||||
void gdextension_initialize(ModuleInitializationLevel p_level)
|
void gdextension_initialize(ModuleInitializationLevel p_level)
|
||||||
{
|
{
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
||||||
{
|
{
|
||||||
ClassDB::register_class<Discord_Activity>();
|
ClassDB::register_class<discord_sdk>();
|
||||||
discordsdk = memnew(Discord_Activity);
|
discordsdk = memnew(discord_sdk);
|
||||||
Engine::get_singleton()->register_singleton("Discord_Activity", Discord_Activity::get_singleton());
|
Engine::get_singleton()->register_singleton("discord_sdk", discord_sdk::get_singleton());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ void gdextension_terminate(ModuleInitializationLevel p_level)
|
|||||||
{
|
{
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
||||||
{
|
{
|
||||||
Engine::get_singleton()->unregister_singleton("Discord_Activity");
|
Engine::get_singleton()->unregister_singleton("discord_sdk");
|
||||||
memdelete(discordsdk);
|
memdelete(discordsdk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user