mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Small change to Bot.cs to pinpoint the logging in hang issue
This commit is contained in:
@@ -216,24 +216,20 @@ public sealed class Bot
|
|||||||
|
|
||||||
private async Task LoginAsync(string token)
|
private async Task LoginAsync(string token)
|
||||||
{
|
{
|
||||||
var clientReady = new TaskCompletionSource<bool>();
|
var clientReady = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
|
|
||||||
Task SetClientReady()
|
async Task SetClientReady()
|
||||||
{
|
{
|
||||||
_ = Task.Run(async () =>
|
clientReady.TrySetResult(true);
|
||||||
|
try
|
||||||
{
|
{
|
||||||
clientReady.TrySetResult(true);
|
foreach (var chan in await Client.GetDMChannelsAsync())
|
||||||
try
|
await chan.CloseAsync();
|
||||||
{
|
}
|
||||||
foreach (var chan in await Client.GetDMChannelsAsync())
|
catch
|
||||||
await chan.CloseAsync();
|
{
|
||||||
}
|
// ignored
|
||||||
catch
|
}
|
||||||
{
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//connect
|
//connect
|
||||||
@@ -241,6 +237,7 @@ public sealed class Bot
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Client.LoginAsync(TokenType.Bot, token);
|
await Client.LoginAsync(TokenType.Bot, token);
|
||||||
|
Log.Information("Starting...");
|
||||||
await Client.StartAsync();
|
await Client.StartAsync();
|
||||||
}
|
}
|
||||||
catch (HttpException ex)
|
catch (HttpException ex)
|
||||||
|
Reference in New Issue
Block a user