Enabled client log everywhere which could hopefully print login errors

This commit is contained in:
Kwoth
2022-03-03 01:42:22 +01:00
parent c903bc9003
commit 01cc6e52d5

View File

@@ -64,7 +64,7 @@ public sealed class Bot
AlwaysResolveStickers = false, AlwaysResolveStickers = false,
AlwaysDownloadDefaultStickers = false, AlwaysDownloadDefaultStickers = false,
GatewayIntents = GatewayIntents.All, GatewayIntents = GatewayIntents.All,
LogGatewayIntentWarnings = false LogGatewayIntentWarnings = false,
}); });
_commandService = new(new() _commandService = new(new()
@@ -75,9 +75,7 @@ public sealed class Bot
// _interactionService = new(Client.Rest); // _interactionService = new(Client.Rest);
#if GLOBAL_NADEKO || DEBUG
Client.Log += Client_Log; Client.Log += Client_Log;
#endif
} }
@@ -236,10 +234,10 @@ public sealed class Bot
Log.Information("Shard {ShardId} logging in ...", Client.ShardId); Log.Information("Shard {ShardId} logging in ...", Client.ShardId);
try try
{ {
Client.Ready += SetClientReady;
await Client.LoginAsync(TokenType.Bot, token); await Client.LoginAsync(TokenType.Bot, token);
Log.Information("Starting...");
await Client.StartAsync(); await Client.StartAsync();
Log.Information("Started");
} }
catch (HttpException ex) catch (HttpException ex)
{ {
@@ -251,10 +249,10 @@ public sealed class Bot
LoginErrorHandler.Handle(ex); LoginErrorHandler.Handle(ex);
Helpers.ReadErrorAndExit(4); Helpers.ReadErrorAndExit(4);
} }
Client.Ready += SetClientReady; await clientReady.Task.ConfigureAwait(false);
await clientReady.Task;
Client.Ready -= SetClientReady; Client.Ready -= SetClientReady;
Client.JoinedGuild += Client_JoinedGuild; Client.JoinedGuild += Client_JoinedGuild;
Client.LeftGuild += Client_LeftGuild; Client.LeftGuild += Client_LeftGuild;