Discord RPC localization, trigger BlockedOnPlayerJoined when joining an instance

This commit is contained in:
Natsumi
2025-08-02 07:46:56 +12:00
parent 2fea5f25b9
commit 806748388b
6 changed files with 74 additions and 40 deletions

View File

@@ -70,6 +70,22 @@ namespace VRCX
if (_client == null && _active)
{
_client = new DiscordRpcClient(_discordAppId);
_client.OnReady += (sender, e) =>
{
_logger.Info("Discord Rich Presence connected: {User}", e.User.DisplayName);
};
_client.OnError += (sender, e) =>
{
_logger.Error("Discord Rich Presence error: {Error}", e.Message);
};
_client.OnConnectionFailed += (sender, e) =>
{
_logger.Error("Discord Rich Presence connection failed: {Error}", e.Type);
};
_client.OnConnectionEstablished += (sender, e) =>
{
_logger.Info("Discord Rich Presence connection established");
};
if (!_client.Initialize())
{
_client.Dispose();
@@ -123,7 +139,7 @@ namespace VRCX
public void SetAssets(
string details,
string state,
string stateUrl,
string detailsUrl,
string largeKey,
string largeText,
@@ -156,8 +172,8 @@ namespace VRCX
}
_presence.Details = LimitByteLength(details, 127);
// _presence.DetailsUrl
_presence.StateUrl = !string.IsNullOrEmpty(stateUrl) ? stateUrl : null;
_presence.DetailsUrl = !string.IsNullOrEmpty(detailsUrl) ? detailsUrl : null;
// _presence.StateUrl
_presence.State = LimitByteLength(state, 127);
_presence.Assets ??= new Assets();