mirror of
https://github.com/Jetsparrow/karmabot.git
synced 2026-01-21 00:56:09 +03:00
Try to only stop the bot once
This was causing errors on CTRL+C.
This commit is contained in:
parent
09c07e6296
commit
3544f521f9
@ -27,6 +27,7 @@ namespace JetKarmaBot
|
||||
RequestChain Chain;
|
||||
Task timeoutWaitTask;
|
||||
CancellationTokenSource timeoutWaitTaskToken;
|
||||
private bool stopped = false;
|
||||
|
||||
public async Task Init()
|
||||
{
|
||||
@ -52,6 +53,7 @@ namespace JetKarmaBot
|
||||
|
||||
public async Task Stop()
|
||||
{
|
||||
if (stopped) return;
|
||||
Client.StopReceiving();
|
||||
timeoutWaitTaskToken.Cancel();
|
||||
try
|
||||
@ -61,6 +63,7 @@ namespace JetKarmaBot
|
||||
catch (OperationCanceledException) { }
|
||||
await Timeout.Save();
|
||||
Dispose();
|
||||
stopped = true;
|
||||
}
|
||||
|
||||
#region service
|
||||
|
||||
Loading…
Reference in New Issue
Block a user