Arrêt plus propre et qui n'empêche plus de se reconnecter automatiquement en cas de perte de réseau (normalement :) )

This commit is contained in:
Christophe Chailloleau-Leclerc 2019-05-30 08:25:22 +02:00
parent c5b30354fc
commit 0f7dd7708e
2 changed files with 7 additions and 6 deletions

View File

@ -30,6 +30,7 @@ namespace Sean.Modules
await guild.DefaultChannel.SendMessageAsync("Ciao les nazes !");
}
await Context.Client.StopAsync();
Environment.Exit(0);
}
#endregion Methods

View File

@ -47,16 +47,16 @@ namespace Sean
await client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken_Sean"));
await client.StartAsync();
client.Disconnected += Client_Disconnected;
//client.Disconnected += Client_Disconnected;
// Block this task until the program is closed.
await Task.Delay(-1);
}
private Task Client_Disconnected(Exception arg)
{
Environment.Exit(0);
return Task.CompletedTask;
}
//private Task Client_Disconnected(Exception arg)
//{
// Environment.Exit(0);
// return Task.CompletedTask;
//}
private static void Main(string[] args)
{