implemented the whole relationship manager
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -67,11 +67,12 @@ func _on_print_current_user_on_console_pressed():
|
|||||||
|
|
||||||
func _on_toggle_sdk_toggled(button_pressed):
|
func _on_toggle_sdk_toggled(button_pressed):
|
||||||
if(button_pressed):
|
if(button_pressed):
|
||||||
debug_text_update()
|
|
||||||
discord_sdk.unclear()
|
discord_sdk.unclear()
|
||||||
else:
|
else:
|
||||||
discord_sdk.clear()
|
discord_sdk.clear()
|
||||||
debug_text_update()
|
|
||||||
|
func _on_print_friends_pressed():
|
||||||
|
print(discord_sdk.get_all_relationships())
|
||||||
"
|
"
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8abo6"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8abo6"]
|
||||||
@@ -163,21 +164,33 @@ anchors_preset = 4
|
|||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
offset_left = 12.0
|
offset_left = 12.0
|
||||||
offset_top = 156.375
|
offset_top = 138.375
|
||||||
offset_right = 245.0
|
offset_right = 245.0
|
||||||
offset_bottom = 189.375
|
offset_bottom = 171.375
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
text = "Print current user on console"
|
text = "Print current user on console"
|
||||||
|
|
||||||
|
[node name="PrintFriends" type="Button" parent="Panel"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = 12.0
|
||||||
|
offset_top = 176.5
|
||||||
|
offset_right = 204.0
|
||||||
|
offset_bottom = 207.5
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "Print friends on console"
|
||||||
|
|
||||||
[node name="AcceptJoinRequest" type="Button" parent="Panel"]
|
[node name="AcceptJoinRequest" type="Button" parent="Panel"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 4
|
anchors_preset = 4
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
offset_left = 12.0
|
offset_left = 12.0
|
||||||
offset_top = 193.875
|
offset_top = 212.875
|
||||||
offset_right = 154.0
|
offset_right = 154.0
|
||||||
offset_bottom = 224.875
|
offset_bottom = 243.875
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
text = "ACCEPT REQUEST"
|
text = "ACCEPT REQUEST"
|
||||||
|
|
||||||
@@ -187,9 +200,9 @@ anchors_preset = 4
|
|||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
offset_left = 11.0
|
offset_left = 11.0
|
||||||
offset_top = 230.375
|
offset_top = 250.375
|
||||||
offset_right = 210.0
|
offset_right = 210.0
|
||||||
offset_bottom = 261.375
|
offset_bottom = 281.375
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 0
|
size_flags_horizontal = 0
|
||||||
placeholder_text = "Invite with user_id here"
|
placeholder_text = "Invite with user_id here"
|
||||||
@@ -200,9 +213,9 @@ anchors_preset = 4
|
|||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
offset_left = 11.0
|
offset_left = 11.0
|
||||||
offset_top = 265.875
|
offset_top = 286.875
|
||||||
offset_right = 260.0
|
offset_right = 260.0
|
||||||
offset_bottom = 296.875
|
offset_bottom = 317.875
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
placeholder_text = "Accept Invite with user_id here"
|
placeholder_text = "Accept Invite with user_id here"
|
||||||
|
|
||||||
@@ -246,6 +259,7 @@ libraries = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[connection signal="pressed" from="Panel/PrintCurrentUserOnConsole" to="." method="_on_print_current_user_on_console_pressed"]
|
[connection signal="pressed" from="Panel/PrintCurrentUserOnConsole" to="." method="_on_print_current_user_on_console_pressed"]
|
||||||
|
[connection signal="pressed" from="Panel/PrintFriends" to="." method="_on_print_friends_pressed"]
|
||||||
[connection signal="pressed" from="Panel/AcceptJoinRequest" to="." method="_on_accept_join_request_pressed"]
|
[connection signal="pressed" from="Panel/AcceptJoinRequest" to="." method="_on_accept_join_request_pressed"]
|
||||||
[connection signal="text_submitted" from="Panel/InviteWithUserID" to="." method="_on_invite_with_user_id_text_submitted"]
|
[connection signal="text_submitted" from="Panel/InviteWithUserID" to="." method="_on_invite_with_user_id_text_submitted"]
|
||||||
[connection signal="text_submitted" from="Panel/AcceptWithUserID" to="." method="_on_accept_with_user_id_text_submitted"]
|
[connection signal="text_submitted" from="Panel/AcceptWithUserID" to="." method="_on_accept_with_user_id_text_submitted"]
|
||||||
|
@@ -1,4 +0,0 @@
|
|||||||
<svg width="16" height="14" viewBox="0 0 16 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.35776 4.35954C0.15745 6.80425 -0.158183 9.20437 0.0679444 11.5772C1.29133 12.4811 2.66066 13.1685 4.11639 13.6096C4.44417 13.1687 4.73422 12.701 4.98346 12.2115C4.51007 12.0346 4.05317 11.8165 3.61804 11.5596C3.73256 11.4765 3.84456 11.3909 3.95279 11.3079C5.21891 11.9033 6.60083 12.212 7.99997 12.212C9.39912 12.212 10.781 11.9033 12.0472 11.3079C12.1566 11.3972 12.2686 11.4828 12.3819 11.5596C11.9459 11.8169 11.4882 12.0355 11.014 12.2127C11.2629 12.7021 11.553 13.1694 11.881 13.6096C13.338 13.1703 14.7084 12.4832 15.932 11.5785C16.1887 8.91658 15.71 6.52885 14.6441 4.35954H1.35776ZM3.90119 8.15294C3.90119 9.03386 4.55307 9.74992 5.34212 9.74992C6.14627 9.74992 6.76795 9.03386 6.78179 8.15294C6.79563 7.27203 6.14879 6.54967 5.3396 6.54967C4.53042 6.54967 3.90119 7.27203 3.90119 8.15294ZM9.21815 8.15294C9.21815 9.03386 9.86752 9.74992 10.6578 9.74992C11.462 9.74992 12.0824 9.03386 12.0962 8.15294C12.1101 7.27203 11.4683 6.54967 10.6578 6.54967C9.84738 6.54967 9.21815 7.27203 9.21815 8.15294Z" fill="#5865F2"/>
|
|
||||||
<path d="M4.31337 0.711094C4.97409 0.378693 5.67883 0.1583 6.39124 0C6.67624 0.478046 6.93634 0.995727 7.16285 1.50181C7.43169 1.45692 7.70147 1.4403 7.97234 1.43708V1.43666C7.97402 1.43666 7.97578 1.43708 7.97746 1.43708C7.97907 1.43708 7.98082 1.43666 7.98271 1.43666V1.43708C8.25308 1.4403 8.5231 1.45692 8.79187 1.50181C9.01852 0.995727 9.27877 0.478046 9.56334 0C10.2761 0.1583 10.9807 0.378693 11.6415 0.711094C11.6264 1.29423 11.5887 1.85296 11.5124 2.42051C11.7685 2.58482 12.0385 2.72584 12.2781 2.91819C12.522 3.10544 12.7702 3.28458 12.9907 3.50357C13.4312 3.21235 13.8976 2.93868 14.3777 2.6971C14.8955 3.25402 15.3798 3.85511 15.7752 4.52774C15.5165 4.9441 15.1789 5.43899 14.8223 5.88763H1.13254C0.823832 5.50544 0.490472 5.01534 0.179688 4.52774C0.575141 3.85511 1.05924 3.25402 1.57697 2.6971C2.05728 2.93868 2.52351 3.21235 2.96401 3.50357C3.18451 3.28458 3.43322 3.10544 3.67673 2.91819C3.9164 2.72584 4.18607 2.58482 4.44266 2.42051C4.3662 1.85296 4.32848 1.29423 4.31337 0.711094Z" fill="#5865F2"/>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 2.1 KiB |
@@ -1,37 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://c70jidlptani4"
|
|
||||||
path="res://.godot/imported/Group_1.svg-8cf36058739c5884a9a47a4dfa7d001a.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://addons/discord-sdk-gd/nodes/assets/Group_1.svg"
|
|
||||||
dest_files=["res://.godot/imported/Group_1.svg-8cf36058739c5884a9a47a4dfa7d001a.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
|
|
@@ -1,11 +1,12 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
print(discord_sdk.get_current_user())
|
|
||||||
set_activity()
|
set_activity()
|
||||||
discord_sdk.connect("activity_join_request",_on_activity_join_request)
|
discord_sdk.connect("activity_join_request",_on_activity_join_request)
|
||||||
discord_sdk.connect("activity_join",_on_activity_join)
|
discord_sdk.connect("activity_join",_on_activity_join)
|
||||||
discord_sdk.connect("activity_spectate",_on_activity_spectate)
|
discord_sdk.connect("activity_spectate",_on_activity_spectate)
|
||||||
|
discord_sdk.connect("relationships_init",_on_relationship_init)
|
||||||
|
discord_sdk.connect("updated_relationship", _on_updated_relationship)
|
||||||
|
|
||||||
func set_activity() -> void:
|
func set_activity() -> void:
|
||||||
discord_sdk.clear()
|
discord_sdk.clear()
|
||||||
@@ -19,8 +20,8 @@ func set_activity() -> void:
|
|||||||
discord_sdk.small_image_text = "Fighting the end boss! D:"
|
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
|
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
|
# It is NOT recommended to manage secrets locally! It's meant to be a payload wich the server understands and
|
||||||
# understands and returns the other variables like current_party_size, party_id etc. Most of the values must differ from the others.
|
# 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))
|
var my_secret: String = str(randi_range(0,999999))
|
||||||
|
|
||||||
discord_sdk.party_id = "mylobbycanbeeverything_" + my_secret
|
discord_sdk.party_id = "mylobbycanbeeverything_" + my_secret
|
||||||
@@ -53,3 +54,10 @@ func _on_activity_join(secret) -> void:
|
|||||||
|
|
||||||
func _on_activity_spectate(secret) -> void:
|
func _on_activity_spectate(secret) -> void:
|
||||||
print(secret)
|
print(secret)
|
||||||
|
|
||||||
|
func _on_relationship_init():
|
||||||
|
print("initialized")
|
||||||
|
|
||||||
|
func _on_updated_relationship(relationship):
|
||||||
|
print(relationship)
|
||||||
|
|
||||||
|
@@ -83,6 +83,9 @@ void discord_sdk::_bind_methods()
|
|||||||
ADD_SIGNAL(MethodInfo("activity_spectate", PropertyInfo(Variant::STRING, "spectate_secret")));
|
ADD_SIGNAL(MethodInfo("activity_spectate", PropertyInfo(Variant::STRING, "spectate_secret")));
|
||||||
ADD_SIGNAL(MethodInfo("activity_join_request", PropertyInfo(Variant::DICTIONARY, "user_requesting")));
|
ADD_SIGNAL(MethodInfo("activity_join_request", PropertyInfo(Variant::DICTIONARY, "user_requesting")));
|
||||||
|
|
||||||
|
ADD_SIGNAL(MethodInfo("relationships_init"));
|
||||||
|
ADD_SIGNAL(MethodInfo("updated_relationship", PropertyInfo(Variant::DICTIONARY, "relationship")));
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("refresh"), &discord_sdk::refresh);
|
ClassDB::bind_method(D_METHOD("refresh"), &discord_sdk::refresh);
|
||||||
ClassDB::bind_method(D_METHOD("clear", "reset_values"), &discord_sdk::clear, DEFVAL(false));
|
ClassDB::bind_method(D_METHOD("clear", "reset_values"), &discord_sdk::clear, DEFVAL(false));
|
||||||
ClassDB::bind_method(D_METHOD("unclear"), &discord_sdk::unclear);
|
ClassDB::bind_method(D_METHOD("unclear"), &discord_sdk::unclear);
|
||||||
@@ -95,6 +98,7 @@ void discord_sdk::_bind_methods()
|
|||||||
ClassDB::bind_method(D_METHOD("accept_invite", "user_id"), &discord_sdk::accept_invite);
|
ClassDB::bind_method(D_METHOD("accept_invite", "user_id"), &discord_sdk::accept_invite);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_current_user"), &discord_sdk::get_current_user);
|
ClassDB::bind_method(D_METHOD("get_current_user"), &discord_sdk::get_current_user);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_all_relationships"), &discord_sdk::get_all_relationships);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_is_overlay_enabled"), &discord_sdk::get_is_overlay_enabled);
|
ClassDB::bind_method(D_METHOD("get_is_overlay_enabled"), &discord_sdk::get_is_overlay_enabled);
|
||||||
ClassDB::bind_method(D_METHOD("get_is_overlay_locked"), &discord_sdk::get_is_overlay_locked);
|
ClassDB::bind_method(D_METHOD("get_is_overlay_locked"), &discord_sdk::get_is_overlay_locked);
|
||||||
@@ -173,23 +177,18 @@ void discord_sdk::set_app_id(int64_t value)
|
|||||||
{ discord_sdk::get_singleton()
|
{ discord_sdk::get_singleton()
|
||||||
->emit_signal("activity_spectate", secret); });
|
->emit_signal("activity_spectate", secret); });
|
||||||
core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user)
|
core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user)
|
||||||
{ Dictionary user_requesting;
|
{ discord_sdk::get_singleton()
|
||||||
user_requesting["avatar"] = user.GetAvatar(); //can be empty when user has no avatar
|
->emit_signal("activity_join_request", user2dict(user)); });
|
||||||
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());//I don't know what the hell i did there but removing ?size=512 will crash the whole editor
|
|
||||||
user_requesting.make_read_only();
|
|
||||||
discord_sdk::get_singleton()
|
|
||||||
->emit_signal("activity_join_request",user_requesting); });
|
|
||||||
|
|
||||||
core->OverlayManager().OnToggle.Connect([](bool is_locked)
|
core->OverlayManager().OnToggle.Connect([](bool is_locked)
|
||||||
{ discord_sdk::get_singleton()
|
{ discord_sdk::get_singleton()
|
||||||
->emit_signal("overlay_toggle", is_locked); });
|
->emit_signal("overlay_toggle", is_locked); });
|
||||||
|
core->RelationshipManager().OnRefresh.Connect([&]()
|
||||||
|
{ discord_sdk::get_singleton()
|
||||||
|
->emit_signal("relationships_init"); });
|
||||||
|
core->RelationshipManager().OnRelationshipUpdate.Connect([&](discord::Relationship const &relationship)
|
||||||
|
{ discord_sdk::get_singleton()
|
||||||
|
->emit_signal("updated_relationship", relationship2dict(relationship)); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -479,20 +478,40 @@ Dictionary discord_sdk::get_current_user()
|
|||||||
{
|
{
|
||||||
discord::User user{};
|
discord::User user{};
|
||||||
core->UserManager().GetCurrentUser(&user);
|
core->UserManager().GetCurrentUser(&user);
|
||||||
userdict["avatar"] = user.GetAvatar(); // can be empty when user has no avatar
|
return user2dict(user);
|
||||||
userdict["is_bot"] = user.GetBot();
|
|
||||||
userdict["discriminator"] = user.GetDiscriminator();
|
|
||||||
userdict["id"] = user.GetId();
|
|
||||||
userdict["username"] = user.GetUsername();
|
|
||||||
if (String(userdict["avatar"]).is_empty())
|
|
||||||
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/embed/avatars/" + std::to_string((userdict["discriminator"].INT % 5) - 1) + ".png").c_str());
|
|
||||||
else
|
|
||||||
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png").c_str());
|
|
||||||
userdict.make_read_only();
|
|
||||||
}
|
}
|
||||||
return userdict;
|
return userdict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dictionary discord_sdk::get_relationship(int64_t user_id)
|
||||||
|
{
|
||||||
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
|
{
|
||||||
|
discord::Relationship relationship{};
|
||||||
|
core->RelationshipManager().Get(user_id, &relationship);
|
||||||
|
return relationship2dict(relationship);
|
||||||
|
}
|
||||||
|
Dictionary dict;
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
Array discord_sdk::get_all_relationships()
|
||||||
|
{
|
||||||
|
Array all_relationships;
|
||||||
|
core->RelationshipManager().Filter(
|
||||||
|
[](discord::Relationship const &relationship) -> bool
|
||||||
|
{ return true; });
|
||||||
|
int32_t friendcount{0};
|
||||||
|
core->RelationshipManager().Count(&friendcount);
|
||||||
|
for (int i = 0; i < friendcount; i++)
|
||||||
|
{
|
||||||
|
discord::Relationship relationship{};
|
||||||
|
core->RelationshipManager().GetAt(2, &relationship);
|
||||||
|
all_relationships.append(relationship2dict(relationship));
|
||||||
|
}
|
||||||
|
return all_relationships;
|
||||||
|
}
|
||||||
|
|
||||||
bool discord_sdk::get_is_discord_working()
|
bool discord_sdk::get_is_discord_working()
|
||||||
{
|
{
|
||||||
return result == discord::Result::Ok && app_id > 0;
|
return result == discord::Result::Ok && app_id > 0;
|
||||||
@@ -502,3 +521,91 @@ int discord_sdk::get_result_int()
|
|||||||
{
|
{
|
||||||
return static_cast<int>(result);
|
return static_cast<int>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dictionary discord_sdk::user2dict(discord::User user)
|
||||||
|
{
|
||||||
|
Dictionary userdict;
|
||||||
|
userdict["avatar"] = user.GetAvatar(); // can be empty when user has no avatar
|
||||||
|
userdict["is_bot"] = user.GetBot();
|
||||||
|
userdict["discriminator"] = user.GetDiscriminator();
|
||||||
|
userdict["id"] = user.GetId();
|
||||||
|
userdict["username"] = user.GetUsername();
|
||||||
|
if (String(userdict["avatar"]).is_empty())
|
||||||
|
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/embed/avatars/" + std::to_string((userdict["discriminator"].INT % 5) - 1) + ".png").c_str());
|
||||||
|
else
|
||||||
|
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png").c_str());
|
||||||
|
userdict.make_read_only();
|
||||||
|
return userdict;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary discord_sdk::relationship2dict(discord::Relationship relationship)
|
||||||
|
{
|
||||||
|
Dictionary dict_relationship;
|
||||||
|
Dictionary presence;
|
||||||
|
Dictionary presence_activity;
|
||||||
|
switch (static_cast<int>(relationship.GetPresence().GetStatus()))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
presence["status"] = "Offline";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
presence["status"] = "Online";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
presence["status"] = "Idle";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
presence["status"] = "DoNotDisturb";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
presence["status"] = "NotAvailable";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
presence_activity["application_id"] = relationship.GetPresence().GetActivity().GetApplicationId();
|
||||||
|
presence_activity["name"] = relationship.GetPresence().GetActivity().GetName();
|
||||||
|
presence_activity["state"] = relationship.GetPresence().GetActivity().GetState();
|
||||||
|
presence_activity["details"] = relationship.GetPresence().GetActivity().GetDetails();
|
||||||
|
presence_activity["large_image"] = relationship.GetPresence().GetActivity().GetAssets().GetLargeImage();
|
||||||
|
presence_activity["large_text"] = relationship.GetPresence().GetActivity().GetAssets().GetLargeText();
|
||||||
|
presence_activity["small_image"] = relationship.GetPresence().GetActivity().GetAssets().GetSmallImage();
|
||||||
|
presence_activity["small_text"] = relationship.GetPresence().GetActivity().GetAssets().GetSmallText();
|
||||||
|
presence_activity["timestamps_start"] = relationship.GetPresence().GetActivity().GetTimestamps().GetStart();
|
||||||
|
presence_activity["timestamps_end"] = relationship.GetPresence().GetActivity().GetTimestamps().GetEnd();
|
||||||
|
presence_activity["instance"] = relationship.GetPresence().GetActivity().GetInstance();
|
||||||
|
presence_activity["party_id"] = relationship.GetPresence().GetActivity().GetParty().GetId();
|
||||||
|
presence_activity["current_party_size"] = relationship.GetPresence().GetActivity().GetParty().GetSize().GetCurrentSize();
|
||||||
|
presence_activity["max_party_size"] = relationship.GetPresence().GetActivity().GetParty().GetSize().GetMaxSize();
|
||||||
|
presence_activity["join_secret"] = relationship.GetPresence().GetActivity().GetSecrets().GetJoin();
|
||||||
|
presence_activity["spectate_secret"] = relationship.GetPresence().GetActivity().GetSecrets().GetSpectate();
|
||||||
|
presence_activity["match_secret"] = relationship.GetPresence().GetActivity().GetSecrets().GetMatch();
|
||||||
|
presence["activity"] = presence_activity;
|
||||||
|
presence.make_read_only();
|
||||||
|
switch (relationship.GetType())
|
||||||
|
{
|
||||||
|
case discord::RelationshipType::None:
|
||||||
|
dict_relationship["type"] = "None";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::Friend:
|
||||||
|
dict_relationship["type"] = "Friend";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::Blocked:
|
||||||
|
dict_relationship["type"] = "Blocked";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::PendingIncoming:
|
||||||
|
dict_relationship["type"] = "PendingIncoming";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::PendingOutgoing:
|
||||||
|
dict_relationship["type"] = "PendingOutgoing";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::Implicit:
|
||||||
|
dict_relationship["type"] = "Implicit";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dict_relationship["type"] = "NotAvailable";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dict_relationship["user"] = user2dict(relationship.GetUser());
|
||||||
|
dict_relationship["presence"] = presence;
|
||||||
|
dict_relationship.make_read_only();
|
||||||
|
return dict_relationship;
|
||||||
|
}
|
@@ -17,7 +17,19 @@ class discord_sdk : public RefCounted
|
|||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
private:
|
public:
|
||||||
|
static discord_sdk *
|
||||||
|
get_singleton();
|
||||||
|
|
||||||
|
discord_sdk();
|
||||||
|
~discord_sdk();
|
||||||
|
|
||||||
|
// INTERBNAL
|
||||||
|
int64_t old_app_id;
|
||||||
|
Dictionary relationship2dict(discord::Relationship relationship);
|
||||||
|
Dictionary user2dict(discord::User user);
|
||||||
|
///
|
||||||
|
|
||||||
int64_t app_id = 0;
|
int64_t app_id = 0;
|
||||||
|
|
||||||
String state;
|
String state;
|
||||||
@@ -44,18 +56,11 @@ private:
|
|||||||
|
|
||||||
bool is_overlay_locked;
|
bool is_overlay_locked;
|
||||||
|
|
||||||
public:
|
|
||||||
static discord_sdk *
|
|
||||||
get_singleton();
|
|
||||||
|
|
||||||
discord_sdk();
|
|
||||||
~discord_sdk();
|
|
||||||
|
|
||||||
void debug();
|
void debug();
|
||||||
void coreupdate();
|
void coreupdate();
|
||||||
void refresh();
|
void refresh();
|
||||||
void clear(bool reset_values);
|
void clear(bool reset_values);
|
||||||
int64_t old_app_id;
|
|
||||||
void unclear();
|
void unclear();
|
||||||
int64_t get_app_id();
|
int64_t get_app_id();
|
||||||
void set_app_id(int64_t value);
|
void set_app_id(int64_t value);
|
||||||
@@ -113,6 +118,8 @@ public:
|
|||||||
void register_steam(int32_t value);
|
void register_steam(int32_t value);
|
||||||
|
|
||||||
Dictionary get_current_user();
|
Dictionary get_current_user();
|
||||||
|
Dictionary get_relationship(int64_t user_id);
|
||||||
|
Array get_all_relationships();
|
||||||
|
|
||||||
bool get_is_discord_working();
|
bool get_is_discord_working();
|
||||||
int get_result_int();
|
int get_result_int();
|
||||||
|
Reference in New Issue
Block a user