Skip to content

Commit

Permalink
Fix URL button blocking the party button.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mailaender authored and abcdefg30 committed Jan 8, 2023
1 parent 43d7f9c commit a397670
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions OpenRA.Mods.Common/DiscordService.cs
Expand Up @@ -115,6 +115,7 @@ void SetStatus(DiscordState state, string details = null, string secret = null,
DateTime? timestamp = null;
Party party = null;
Secrets secrets = null;
Button[] buttons = null;

switch (state)
{
Expand Down Expand Up @@ -161,6 +162,18 @@ void SetStatus(DiscordState state, string details = null, string secret = null,
throw new ArgumentOutOfRangeException(nameof(state), state, null);
}

if (party == null)
{
buttons = new[]
{
new Button
{
Label = "Visit Website",
Url = Game.ModData.Manifest.Metadata.Website
}
};
}

var richPresence = new RichPresence
{
Details = details,
Expand All @@ -173,14 +186,7 @@ void SetStatus(DiscordState state, string details = null, string secret = null,
Timestamps = timestamp.HasValue ? new Timestamps(timestamp.Value) : null,
Party = party,
Secrets = secrets,
Buttons = new[]
{
new Button
{
Label = "Visit Website",
Url = Game.ModData.Manifest.Metadata.Website
}
}
Buttons = buttons
};

client.SetPresence(richPresence);
Expand Down

0 comments on commit a397670

Please sign in to comment.