You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

runasync.cs 515 B

1234567891011121314151617
  1. async Task RunAsync(string[] args)
  2. {
  3. // Request the instance from the client.
  4. // Because we're requesting it here first, its targetted constructor will be called and we will receive an active instance.
  5. var client = _services.GetRequiredService<DiscordSocketClient>();
  6. client.Log += async (msg) =>
  7. {
  8. await Task.CompletedTask;
  9. Console.WriteLine(msg);
  10. }
  11. await client.LoginAsync(TokenType.Bot, "");
  12. await client.StartAsync();
  13. await Task.Delay(Timeout.Infinite);
  14. }