From e4809ea50962f1f71c50593a76df2414f9dbbac4 Mon Sep 17 00:00:00 2001 From: Alex Gravely Date: Fri, 14 Jul 2017 00:20:20 -0400 Subject: [PATCH] Update client.cs Let's not have the client be a local variable, hm? --- docs/guides/getting_started/samples/intro/client.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/guides/getting_started/samples/intro/client.cs b/docs/guides/getting_started/samples/intro/client.cs index ea7c91932..a73082052 100644 --- a/docs/guides/getting_started/samples/intro/client.cs +++ b/docs/guides/getting_started/samples/intro/client.cs @@ -1,16 +1,17 @@ // Program.cs using Discord.WebSocket; // ... +private DiscordSocketClient _client; public async Task MainAsync() { - var client = new DiscordSocketClient(); + _client = new DiscordSocketClient(); - client.Log += Log; + _client.Log += Log; string token = "abcdefg..."; // Remember to keep this private! - await client.LoginAsync(TokenType.Bot, token); - await client.StartAsync(); + await _client.LoginAsync(TokenType.Bot, token); + await _client.StartAsync(); // Block this task until the program is closed. await Task.Delay(-1); -} \ No newline at end of file +}