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.

getting_started.cs 919 B

1234567891011121314151617181920212223242526
  1. class Program
  2. {
  3. private static DiscordBotClient _client;
  4. static void Main(string[] args)
  5. {
  6. var client = new DiscordClient();
  7. //Echo any message received, provided it didn't come from us
  8. client.MessageCreated += async (s, e) =>
  9. {
  10. if (!e.Message.IsAuthor)
  11. await client.SendMessage(e.Message.ChannelId, e.Message.Text);
  12. };
  13. //Convert our sync method to an async one and blocks this function until the client disconnects
  14. client.Run(async () =>
  15. {
  16. //Connect to the Discord server usinotng our email and password
  17. await client.Connect("discordtest@email.com", "Password123");
  18. //If we are not a member of any server, use our invite code
  19. if (!client.Servers.Any())
  20. await client.AcceptInvite("aaabbbcccdddeee");
  21. });
  22. }
  23. }

Introduction

No Description

No topics