Browse Source

Add additional notes for the Program class

pull/1257/head
Still Hsu 6 years ago
parent
commit
8a6988f4a4
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      samples/02_commands_framework/Program.cs

+ 3
- 1
samples/02_commands_framework/Program.cs View File

@@ -37,10 +37,12 @@ namespace _02_commands_framework
client.Log += LogAsync; client.Log += LogAsync;
services.GetRequiredService<CommandService>().Log += LogAsync; services.GetRequiredService<CommandService>().Log += LogAsync;


// Tokens should be considered secret data, and never hard-coded.
// Tokens should be considered secret data and never hard-coded.
// We can read from the environment variable to prevent such practices.
await client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("token")); await client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("token"));
await client.StartAsync(); await client.StartAsync();


// Here we initialize the logic required to register our commands.
await services.GetRequiredService<CommandHandlingService>().InitializeAsync(); await services.GetRequiredService<CommandHandlingService>().InitializeAsync();


await Task.Delay(-1); await Task.Delay(-1);


Loading…
Cancel
Save