diff --git a/CHEF/Logger.cs b/CHEF/Logger.cs index fbb7033..21b3abf 100644 --- a/CHEF/Logger.cs +++ b/CHEF/Logger.cs @@ -20,7 +20,20 @@ internal static void Init(DiscordSocketClient client) const long iDeathHdId = 125598628310941697; _client = client; - _reportToUser = client.GetGuild(ror2ServerId)?.GetUser(iDeathHdId) ?? (IGuildUser) _client.Rest.GetGuildUserAsync(ror2ServerId, iDeathHdId).Result; + var guild = client.GetGuild(ror2ServerId); + if (guild == null) + { + Console.WriteLine("guild was null"); + } + else + { + _reportToUser = guild.GetUser(iDeathHdId); + if (_reportToUser == null) + { + Console.WriteLine("_reportToUser was null"); + _reportToUser = _client.Rest.GetGuildUserAsync(ror2ServerId, iDeathHdId).Result; + } + } } internal static void Log(string msg)