Browse Source

Clarify token source

pull/1161/head
Still Hsu 7 years ago
parent
commit
105182f53a
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
2 changed files with 7 additions and 7 deletions
  1. +6
    -2
      docs/guides/getting_started/samples/first-bot/client.cs
  2. +1
    -5
      docs/guides/getting_started/samples/first-bot/complete.cs

+ 6
- 2
docs/guides/getting_started/samples/first-bot/client.cs View File

@@ -6,8 +6,12 @@ public async Task MainAsync()


_client.Log += Log; _client.Log += Log;


// Remember to keep token private or to read it
// from an external source!
// Remember to keep token private or to read it from an
// external source! In this case, we are reading the token
// from an environment variable. If you do not know how to set-up
// environment variables, you may find more information on the
// Internet or by using other methods such as reading from
// a configuration.
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken")); await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken"));
await _client.StartAsync(); await _client.StartAsync();




+ 1
- 5
docs/guides/getting_started/samples/first-bot/complete.cs View File

@@ -8,15 +8,11 @@ public class Program
public async Task MainAsync() public async Task MainAsync()
{ {
_client = new DiscordSocketClient(); _client = new DiscordSocketClient();

_client.Log += Log; _client.Log += Log;
_client.MessageReceived += MessageReceivedAsync; _client.MessageReceived += MessageReceivedAsync;

// Remember to keep this private or to read this
// from an external source!
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken")); await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken"));
await _client.StartAsync(); await _client.StartAsync();
// Block this task until the program is closed. // Block this task until the program is closed.
await Task.Delay(-1); await Task.Delay(-1);
} }


Loading…
Cancel
Save