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.

intro.md 1.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---
  2. title: Getting Started
  3. ---
  4. # Getting Started
  5. ## Requirements
  6. Discord.Net supports logging in with all variations of Discord Accounts, however the Discord API reccomends using a `Bot Account`.
  7. You may [register a bot account here](https://discordapp.com/developers/applications/me).
  8. Bot accounts must be added to a server, you must use the [OAuth 2 Flow](https://discordapp.com/developers/docs/topics/oauth2#adding-bots-to-guilds) to add them to servers.
  9. ## Installation
  10. You can install Discord.Net 1.0 from our [MyGet Feed](https://www.myget.org/feed/Packages/discord-net).
  11. **For most users writing bots, install only `Discord.Net.WebSocket`.**
  12. You may add the MyGet feed to Visual Studio directly from `https://www.myget.org/F/discord-net/api/v3/index.json`.
  13. You can also pull the latest source from [GitHub](https://github.com/RogueException/Discord.Net).
  14. >[!WARNING]
  15. >The versions of Discord.Net on NuGet are behind the versions this
  16. >documentation is written for.
  17. >You MUST install from MyGet or Source!
  18. ## Async
  19. Discord.Net uses C# tasks extensiely - nearly all operations return
  20. one.
  21. It is highly reccomended these tasks be awaited whenever possible.
  22. To do so requires the calling method to be marked as async, which
  23. can be problematic in a console application. An example of how to
  24. get around this is provided below.
  25. For more information, go to [MSDN's Async-Await section.](https://msdn.microsoft.com/en-us/library/hh191443.aspx)
  26. ## First Steps
  27. [!code-csharp[Main](samples/first-steps.cs)]
  28. >[!NOTE]
  29. >In previous versions of Discord.Net, you had to hook into the `Ready` and `GuildAvailable` events to determine when your client was ready for use.
  30. >In 1.0, the [ConnectAsync](xref:Discord.DiscordSocketClient#ConnectAsync) method will automatically wait for the Ready event, and for all guilds to stream. To avoid this, pass `false` into `ConnectAsync`.