Skip to content

Commit

Permalink
Adjust log message and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed Mar 10, 2024
1 parent 98ca021 commit 283de21
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions osu.Desktop/DiscordRichPresence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,14 @@ private void updateStatus()
private void onJoin(object sender, JoinMessage args)
{
game.Window?.Raise();
Logger.Log($"Received room secret from Discord RPC Client: {args.Secret}", LoggingTarget.Network, LogLevel.Debug);

// Stable and Lazer share the same Discord client ID, meaning they can accept join requests from each other.
// Since they aren't compatible in multi, see if stable's format is being used and log to avoid confusion.
// https://discord.com/channels/188630481301012481/188630652340404224/1214697229063946291
if (args.Secret[0] != '{')
{
Logger.Log("osu!stable rooms are not compatible with lazer.", LoggingTarget.Network, LogLevel.Important);
return;
}
Logger.Log($"Received room secret from Discord RPC Client: \"{args.Secret}\"", LoggingTarget.Network, LogLevel.Debug);

if (!tryParseRoomSecret(args.Secret, out long roomId, out string? password))
// Stable and lazer share the same Discord client ID, meaning they can accept join requests from each other.
// Since they aren't compatible in multi, see if stable's format is being used and log to avoid confusion.
if (args.Secret[0] != '{' || !tryParseRoomSecret(args.Secret, out long roomId, out string? password))
{
Logger.Log("Could not join multiplayer room.", LoggingTarget.Network, LogLevel.Important);
Logger.Log("Could not join multiplayer room, invitation is invalid or incompatible.", LoggingTarget.Network, LogLevel.Important);
return;
}

Expand All @@ -211,7 +205,7 @@ private void onJoin(object sender, JoinMessage args)
{
game.PresentMultiplayerMatch(room, password);
});
request.Failure += _ => Logger.Log($"Could not find room {roomId} from Discord RPC Client", LoggingTarget.Network, LogLevel.Important);
request.Failure += _ => Logger.Log($"Could not join multiplayer room, room could not be found (room ID: {roomId}).", LoggingTarget.Network, LogLevel.Important);
api.Queue(request);
}

Expand Down

0 comments on commit 283de21

Please sign in to comment.