mirror of https://github.com/ppy/osu
Merge all presence methods into one
I'm about to make them interdependent (and it's discord's fault), so it doesn't really make sense to make them separate at this point I don't think. And it felt weird anyway.
This commit is contained in:
parent
e95f29cf4b
commit
a398754a27
|
@ -134,16 +134,14 @@ private void schedulePresenceUpdate()
|
|||
|
||||
bool hideIdentifiableInformation = privacyMode.Value == DiscordRichPresenceMode.Limited || status.Value == UserStatus.DoNotDisturb;
|
||||
|
||||
updatePresenceStatus(hideIdentifiableInformation);
|
||||
updatePresenceParty(hideIdentifiableInformation);
|
||||
updatePresenceAssets();
|
||||
|
||||
updatePresence(hideIdentifiableInformation);
|
||||
client.SetPresence(presence);
|
||||
}, 200);
|
||||
}
|
||||
|
||||
private void updatePresenceStatus(bool hideIdentifiableInformation)
|
||||
private void updatePresence(bool hideIdentifiableInformation)
|
||||
{
|
||||
// user activity
|
||||
if (activity.Value != null)
|
||||
{
|
||||
presence.State = truncate(activity.Value.GetStatus(hideIdentifiableInformation));
|
||||
|
@ -170,10 +168,8 @@ private void updatePresenceStatus(bool hideIdentifiableInformation)
|
|||
presence.State = "Idle";
|
||||
presence.Details = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePresenceParty(bool hideIdentifiableInformation)
|
||||
{
|
||||
// user party
|
||||
if (!hideIdentifiableInformation && multiplayerClient.Room != null)
|
||||
{
|
||||
MultiplayerRoom room = multiplayerClient.Room;
|
||||
|
@ -201,11 +197,9 @@ private void updatePresenceParty(bool hideIdentifiableInformation)
|
|||
presence.Party = null;
|
||||
presence.Secrets.JoinSecret = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePresenceAssets()
|
||||
{
|
||||
// update user information
|
||||
// game images:
|
||||
// large image tooltip
|
||||
if (privacyMode.Value == DiscordRichPresenceMode.Limited)
|
||||
presence.Assets.LargeImageText = string.Empty;
|
||||
else
|
||||
|
@ -216,7 +210,7 @@ private void updatePresenceAssets()
|
|||
presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.GlobalRank > 0 ? $" (rank #{user.Value.Statistics.GlobalRank:N0})" : string.Empty);
|
||||
}
|
||||
|
||||
// update ruleset
|
||||
// small image
|
||||
presence.Assets.SmallImageKey = ruleset.Value.IsLegacyRuleset() ? $"mode_{ruleset.Value.OnlineID}" : "mode_custom";
|
||||
presence.Assets.SmallImageText = ruleset.Value.Name;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue