Skip to content

Commit

Permalink
Prepare a change for !ign when restructuring goes live
Browse files Browse the repository at this point in the history
  • Loading branch information
Plenyx committed May 22, 2024
1 parent 52c71fd commit 4782d41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,9 +1201,16 @@ protected async void ReadMessagesAsync(object sender, IrcMessage ircMessage)
}
using var gw2Api = new Gw2ApiHelper(trueApiKey.ApiKey);
var userInfo = await gw2Api.GetUserInfoAsync();
if ((userInfo is not null) && Gw2.AllServers.TryGetValue(userInfo.World, out var playerWorld))
if (userInfo is not null)
{
await chatConnect.SendChatMessageAsync(ApplicationSettings.Current.Twitch.ChannelName, $"GW2 Account name: {userInfo.Name} | Server: {playerWorld.Name} ({playerWorld.Region})");
if (Gw2.AllServers.TryGetValue(userInfo.World ?? 0, out var playerWorld))
{
await chatConnect.SendChatMessageAsync(ApplicationSettings.Current.Twitch.ChannelName, $"GW2 Account name: {userInfo.Name} | Server: {playerWorld.Name} ({playerWorld.Region})");
}
else
{
await chatConnect.SendChatMessageAsync(ApplicationSettings.Current.Twitch.ChannelName, $"GW2 Account name: {userInfo.Name})");
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Gw2Api/Gw2Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal sealed class Gw2Account
internal string Name { get; set; }

[JsonProperty("world")]
internal int World { get; set; }
internal int? World { get; set; }

[JsonProperty("wvw_rank")]
internal int WvwRank { get; set; }
Expand Down

0 comments on commit 4782d41

Please sign in to comment.