more precise discord errors
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,4 +0,0 @@
|
||||
extends Node
|
||||
|
||||
func _process(delta):
|
||||
Discord_SDK.coreupdate()
|
@@ -5,9 +5,9 @@ const ExportPlugin = preload("res://addons/discord-sdk-gd/export.gd")
|
||||
var loaded_exportplugin = ExportPlugin.new()
|
||||
|
||||
func _enter_tree():
|
||||
add_autoload_singleton("discord_coreupdater", "res://addons/discord-sdk-gd/discord_coreupdater.gd")
|
||||
add_autoload_singleton("DiscordSDK", "res://addons/discord-sdk-gd/sdk_utility.gd")
|
||||
add_export_plugin(loaded_exportplugin)
|
||||
|
||||
func disable_plugin():
|
||||
remove_autoload_singleton("discord_coreupdater")
|
||||
remove_autoload_singleton("DiscordSDK")
|
||||
remove_export_plugin(loaded_exportplugin)
|
||||
|
55
project/addons/discord-sdk-gd/sdk_utility.gd
Normal file
55
project/addons/discord-sdk-gd/sdk_utility.gd
Normal file
@@ -0,0 +1,55 @@
|
||||
extends Node
|
||||
|
||||
const result: Array[String] = [
|
||||
"Ok",
|
||||
"ServiceUnavailable",
|
||||
"InvalidVersion",
|
||||
"LockFailed",
|
||||
"InternalError",
|
||||
"InvalidPayload",
|
||||
"InvalidCommand",
|
||||
"InvalidPermissions",
|
||||
"NotFetched",
|
||||
"NotFound",
|
||||
"Conflict",
|
||||
"InvalidSecret",
|
||||
"InvalidJoinSecret",
|
||||
"NoEligibleActivity",
|
||||
"InvalidInvite",
|
||||
"NotAuthenticated",
|
||||
"InvalidAccessToken",
|
||||
"ApplicationMismatch",
|
||||
"InvalidDataUrl",
|
||||
"InvalidBase64",
|
||||
"NotFiltered",
|
||||
"LobbyFull",
|
||||
"InvalidLobbySecret",
|
||||
"InvalidFilename",
|
||||
"InvalidFileSize",
|
||||
"InvalidEntitlement",
|
||||
"NotInstalled",
|
||||
"NotRunning",
|
||||
"InsufficientBuffer",
|
||||
"PurchaseCanceled",
|
||||
"InvalidGuild",
|
||||
"InvalidEvent",
|
||||
"InvalidChannel",
|
||||
"InvalidOrigin",
|
||||
"RateLimited",
|
||||
"OAuth2Error",
|
||||
"SelectChannelTimeout",
|
||||
"GetGuildTimeout",
|
||||
"SelectVoiceForceRequired",
|
||||
"CaptureShortcutAlreadyListening",
|
||||
"UnauthorizedForAchievement",
|
||||
"InvalidGiftCode",
|
||||
"PurchaseError",
|
||||
"TransactionAborted",
|
||||
"DrawingInitFailed"
|
||||
]
|
||||
|
||||
func _process(delta):
|
||||
Discord_SDK.coreupdate()
|
||||
|
||||
func get_sdk_info():
|
||||
return result[Discord_SDK.get_result_int()]
|
@@ -1,19 +1,19 @@
|
||||
extends Node
|
||||
|
||||
func _ready():
|
||||
Discord_SDK.debug()
|
||||
#Discord_SDK.app_id = 1099618430065324082
|
||||
#Discord_SDK.details = "A demo activity by vaporvee#1231"
|
||||
#Discord_SDK.state = "Checkpoint 23/23"
|
||||
#Discord_SDK.debug()
|
||||
Discord_SDK.app_id = 1099618430065324082
|
||||
Discord_SDK.details = "A demo activity by vaporvee#1231"
|
||||
Discord_SDK.state = "Checkpoint 23/23"
|
||||
|
||||
#Discord_SDK.large_image = "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.large_image = "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.start_timestamp = int(Time.get_unix_time_from_system())
|
||||
# Discord_SDK.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_SDK.refresh()
|
||||
Discord_SDK.refresh()
|
||||
|
||||
$Info.text = $Info.text.replace("{isdiscordworking}",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}",DiscordSDK.get_sdk_info()).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))
|
||||
|
@@ -46,7 +46,7 @@ offset_left = 7.0
|
||||
offset_top = 6.0
|
||||
offset_right = 514.0
|
||||
offset_bottom = 722.0
|
||||
text = "Is Discord working: {isdiscordworking}
|
||||
text = "Discord info: {discordinfo}
|
||||
|
||||
Application ID : {id}
|
||||
Details: {details}
|
||||
|
@@ -20,7 +20,7 @@ config/icon="res://assets/Logo_V2.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
discord_coreupdater="*res://addons/discord-sdk-gd/discord_coreupdater.gd"
|
||||
DiscordSDK="*res://addons/discord-sdk-gd/sdk_utility.gd"
|
||||
|
||||
[dotnet]
|
||||
|
||||
|
@@ -51,7 +51,7 @@ void Discord_SDK::_bind_methods()
|
||||
|
||||
ClassDB::bind_method(D_METHOD("refresh"), &Discord_SDK::refresh);
|
||||
|
||||
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_SDK *Discord_SDK::get_singleton()
|
||||
@@ -192,7 +192,7 @@ int64_t Discord_SDK::get_end_timestamp() const
|
||||
return activity.GetTimestamps().GetEnd();
|
||||
}
|
||||
|
||||
bool Discord_SDK::get_is_discord_working() const
|
||||
int Discord_SDK::get_result_int() const
|
||||
{
|
||||
return result == discord::Result::Ok;
|
||||
return static_cast<int>(result);
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
#define DISCORDGODOT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "discord-game-sdk-cpp/discord.h"
|
||||
#include <godot_cpp/classes/object.hpp>
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
|
||||
@@ -62,7 +63,7 @@ public:
|
||||
int64_t get_end_timestamp() const;
|
||||
void set_end_timestamp(const int64_t &value);
|
||||
|
||||
bool get_is_discord_working() const;
|
||||
int get_result_int() const;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user