Skip to content

Commit

Permalink
actually wait for bot to be connected before querying guild info
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiao921 committed Jun 18, 2020
1 parent 8702675 commit dec5690
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
13 changes: 8 additions & 5 deletions CHEF/CHEF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ public static void Main(string[] args)

private async Task MainAsync()
{
SetupBotLogin().Wait();

Logger.Init(_client);

Database.Init();
await SetupBotLogin();

await ComponentHandler.Init(_client);

_client.Ready += () =>
{
Logger.Init(_client);
Database.Init();
return Task.CompletedTask;
};

await Task.Delay(-1);
}

Expand Down
7 changes: 1 addition & 6 deletions CHEF/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@ internal static void Init(DiscordSocketClient client)

_client = client;
var guild = client.GetGuild(ror2ServerId);
if (guild == null)
{
Console.WriteLine("guild was null");
}
else
if (guild != null)
{
_reportToUser = guild.GetUser(iDeathHdId);
if (_reportToUser == null)
{
Console.WriteLine("_reportToUser was null");
_reportToUser = _client.Rest.GetGuildUserAsync(ror2ServerId, iDeathHdId).Result;
}
}
Expand Down

0 comments on commit dec5690

Please sign in to comment.