summaryrefslogtreecommitdiff
path: root/DiscoBot/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'DiscoBot/Program.cs')
-rw-r--r--DiscoBot/Program.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/DiscoBot/Program.cs b/DiscoBot/Program.cs
index b90ed54..7ae8244 100644
--- a/DiscoBot/Program.cs
+++ b/DiscoBot/Program.cs
@@ -24,7 +24,7 @@ namespace DiscoBot
public async Task Start()
{
- DSA.Startup();
+ var loading = DSA.Startup();
client = new DiscordSocketClient();
commands = new CommandService();
@@ -32,12 +32,14 @@ namespace DiscoBot
services = new ServiceCollection()
.BuildServiceProvider();
+ AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);
await InstallCommands();
await client.LoginAsync(TokenType.Bot, token);
await client.StartAsync();
+ await loading;
await Task.Delay(-1);
}
@@ -66,6 +68,11 @@ namespace DiscoBot
if (!result.IsSuccess)
await context.Channel.SendMessageAsync(result.ErrorReason);
}
+ static void OnProcessExit(object sender, EventArgs e)
+ {
+ Console.WriteLine("I'm out of here");
+ Voice.client.StopAsync();
+ }
}
}