Browse Source

Update client.cs

Let's not have the client be a local variable, hm?
pull/752/head^2
Alex Gravely GitHub 8 years ago
parent
commit
e4809ea509
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      docs/guides/getting_started/samples/intro/client.cs

+ 6
- 5
docs/guides/getting_started/samples/intro/client.cs View File

@@ -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);
}
}

Loading…
Cancel
Save