Browse Source

Read token from Environment Variable instead of hardcode

pull/988/head
Still Hsu 7 years ago
parent
commit
929077d717
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
7 changed files with 10 additions and 10 deletions
  1. +2
    -1
      docs/guides/commands/samples/require_owner.cs
  2. +2
    -1
      docs/guides/commands/samples/typereader.cs
  3. +1
    -1
      docs/guides/concepts/samples/connections.cs
  4. +1
    -1
      docs/guides/concepts/samples/events.cs
  5. +1
    -1
      docs/guides/concepts/samples/logging.cs
  6. +2
    -3
      docs/guides/getting_started/samples/first-bot/client.cs
  7. +1
    -2
      docs/guides/getting_started/samples/first-bot/complete.cs

+ 2
- 1
docs/guides/commands/samples/require_owner.cs View File

@@ -1,4 +1,5 @@
// (Note: This precondition is obsolete, it is recommended to use the RequireOwnerAttribute that is bundled with Discord.Commands)
// (Note: This precondition is obsolete, it is recommended to use the
// RequireOwnerAttribute that is bundled with Discord.Commands)

using Discord.Commands;
using Discord.WebSocket;


+ 2
- 1
docs/guides/commands/samples/typereader.cs View File

@@ -1,4 +1,5 @@
// Note: This example is obsolete, a boolean type reader is bundled with Discord.Commands
// Note: This example is obsolete, a boolean type reader is bundled
// with Discord.Commands
using Discord;
using Discord.Commands;



+ 1
- 1
docs/guides/concepts/samples/connections.cs View File

@@ -10,7 +10,7 @@ public class Program
{
_client = new DiscordSocketClient();

await _client.LoginAsync(TokenType.Bot, "bot token");
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken"));
await _client.StartAsync();

Console.WriteLine("Press any key to exit...");


+ 1
- 1
docs/guides/concepts/samples/events.cs View File

@@ -14,7 +14,7 @@ public class Program
var _config = new DiscordSocketConfig { MessageCacheSize = 100 };
_client = new DiscordSocketClient(_config);

await _client.LoginAsync(TokenType.Bot, "bot token");
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken"));
await _client.StartAsync();

_client.MessageUpdated += MessageUpdated;


+ 1
- 1
docs/guides/concepts/samples/logging.cs View File

@@ -15,7 +15,7 @@ public class Program

_client.Log += Log;

await _client.LoginAsync(TokenType.Bot, "bot token");
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken"));
await _client.StartAsync();
await Task.Delay(-1);


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

@@ -6,10 +6,9 @@ public async Task MainAsync()

_client.Log += Log;

// Remember to keep this private or to read this
// Remember to keep token private or to read it
// from an external source!
string token = "abcdefg...";
await _client.LoginAsync(TokenType.Bot, token);
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken"));
await _client.StartAsync();

// Block this task until the program is closed.


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

@@ -14,8 +14,7 @@ public class Program

// Remember to keep this private or to read this
// from an external source!
string token = "abcdefg...";
await _client.LoginAsync(TokenType.Bot, token);
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken"));
await _client.StartAsync();

// Block this task until the program is closed.


Loading…
Cancel
Save