mirror of
https://github.com/yuzu-emu/discord-rpc.git
synced 2024-12-22 08:25:37 +00:00
Update Unreal Example to include Ask to Join (#125)
This commit is contained in:
parent
453222075b
commit
f5f2d69a72
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
/.vscode/
|
||||
/thirdparty/
|
||||
.vs/
|
||||
.DS_Store
|
Binary file not shown.
|
@ -59,7 +59,7 @@ static void JoinRequestHandler(const DiscordJoinRequest* request)
|
|||
jr.username = ANSI_TO_TCHAR(request->username);
|
||||
jr.discriminator = ANSI_TO_TCHAR(request->discriminator);
|
||||
jr.avatar = ANSI_TO_TCHAR(request->avatar);
|
||||
UE_LOG(Discord, Log, TEXT("Discord join request from %s#%s"), *jr.username, *jr.discriminator);
|
||||
UE_LOG(Discord, Log, TEXT("Discord join request from %s - %s#%s"), *jr.userId, *jr.username, *jr.discriminator);
|
||||
if (self) {
|
||||
self->OnJoinRequest.Broadcast(jr);
|
||||
}
|
||||
|
@ -134,9 +134,6 @@ void UDiscordRpc::UpdatePresence()
|
|||
|
||||
auto spectateSecret = StringCast<ANSICHAR>(*RichPresence.spectateSecret);
|
||||
rp.spectateSecret = spectateSecret.Get();
|
||||
|
||||
rp.startTimestamp = RichPresence.startTimestamp;
|
||||
rp.endTimestamp = RichPresence.endTimestamp;
|
||||
rp.partySize = RichPresence.partySize;
|
||||
rp.partyMax = RichPresence.partyMax;
|
||||
rp.instance = RichPresence.instance;
|
||||
|
@ -148,3 +145,10 @@ void UDiscordRpc::ClearPresence()
|
|||
{
|
||||
Discord_ClearPresence();
|
||||
}
|
||||
|
||||
void UDiscordRpc::Respond(const FString& userId, int reply)
|
||||
{
|
||||
UE_LOG(Discord, Log, TEXT("Responding %d to join request from %s"), reply, *userId);
|
||||
FTCHARToUTF8 utf8_userid(*userId);
|
||||
Discord_Respond(utf8_userid.Get(), reply);
|
||||
}
|
||||
|
|
|
@ -111,6 +111,11 @@ public:
|
|||
Category = "Discord")
|
||||
void ClearPresence();
|
||||
|
||||
UFUNCTION(BlueprintCallable,
|
||||
meta = (DisplayName = "Respond to join request", Keywords = "Discord rpc"),
|
||||
Category = "Discord")
|
||||
void Respond(const FString& userId, int reply);
|
||||
|
||||
UPROPERTY(BlueprintReadOnly,
|
||||
meta = (DisplayName = "Is Discord connected", Keywords = "Discord rpc"),
|
||||
Category = "Discord")
|
||||
|
|
Loading…
Reference in a new issue