@@ -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.Commands; | ||||
using Discord.WebSocket; | using Discord.WebSocket; | ||||
@@ -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; | ||||
using Discord.Commands; | using Discord.Commands; | ||||
@@ -10,7 +10,7 @@ public class Program | |||||
{ | { | ||||
_client = new DiscordSocketClient(); | _client = new DiscordSocketClient(); | ||||
await _client.LoginAsync(TokenType.Bot, "bot token"); | |||||
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken")); | |||||
await _client.StartAsync(); | await _client.StartAsync(); | ||||
Console.WriteLine("Press any key to exit..."); | Console.WriteLine("Press any key to exit..."); | ||||
@@ -14,7 +14,7 @@ public class Program | |||||
var _config = new DiscordSocketConfig { MessageCacheSize = 100 }; | var _config = new DiscordSocketConfig { MessageCacheSize = 100 }; | ||||
_client = new DiscordSocketClient(_config); | _client = new DiscordSocketClient(_config); | ||||
await _client.LoginAsync(TokenType.Bot, "bot token"); | |||||
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken")); | |||||
await _client.StartAsync(); | await _client.StartAsync(); | ||||
_client.MessageUpdated += MessageUpdated; | _client.MessageUpdated += MessageUpdated; | ||||
@@ -15,7 +15,7 @@ public class Program | |||||
_client.Log += Log; | _client.Log += Log; | ||||
await _client.LoginAsync(TokenType.Bot, "bot token"); | |||||
await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DiscordToken")); | |||||
await _client.StartAsync(); | await _client.StartAsync(); | ||||
await Task.Delay(-1); | await Task.Delay(-1); | ||||
@@ -6,10 +6,9 @@ public async Task MainAsync() | |||||
_client.Log += Log; | _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! | // from an external source! | ||||
string token = "abcdefg..."; | |||||
await _client.LoginAsync(TokenType.Bot, token); | |||||
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. | ||||
@@ -14,8 +14,7 @@ public class Program | |||||
// Remember to keep this private or to read this | // Remember to keep this private or to read this | ||||
// from an external source! | // from an external source! | ||||
string token = "abcdefg..."; | |||||
await _client.LoginAsync(TokenType.Bot, token); | |||||
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. | ||||