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.7 KiB

1234567891011121314151617181920212223242526272829303132333435363738
  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. You may add the MyGet feed to Visual Studio directly from `https://www.myget.org/F/discord-net/api/v3/index.json`.
  12. You can also pull the latest source from [GitHub](https://github.com/RogueException/Discord.Net).
  13. >[!WARNING]
  14. >The versions of Discord.Net on NuGet are behind the versions this documentation is written for.
  15. ## Async
  16. Discord.Net uses C# tasks extensiely - nearly all operations return one. It is highly reccomended these tasks be awaited whenever possible. To do so requires the calling method to be marked as async, which can be problematic in a console application. An example of how to get around this is provided below.
  17. For more information, go to [MSDN's Async-Await section.](https://msdn.microsoft.com/en-us/library/hh191443.aspx)
  18. ## First Steps
  19. [!code-csharp[Main](samples/first-steps.cs)]
  20. >[!NOTE]
  21. >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.
  22. >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`.