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.md 3.5 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Basic Concepts / Getting Started
  2. ## How do I get started?
  3. First of all, welcome! Before you delve into using the library;
  4. however, you should have some decent understanding of the language
  5. you are about to use. This library touches on
  6. [Task-based Asynchronous Pattern], [polymorphism], [interface] and
  7. many more advanced topics extensively. Please make sure that you
  8. understand these topics to some extent before proceeding.
  9. Here are some examples:
  10. 1. [Official quick start guide](https://github.com/RogueException/Discord.Net/blob/dev/docs/guides/getting_started/samples/intro/structure.cs)
  11. 2. [Official template](https://github.com/foxbot/DiscordBotBase/tree/csharp/src/DiscordBot)
  12. Please note that you should *not* try to blindly copy paste the code.
  13. It is meant to be a template or a guide. It is not meant to be
  14. something that will work out of the box.
  15. [Task-based Asynchronous Pattern]: https://docs.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap
  16. [polymorphism]: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/polymorphism
  17. [interface]: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/interfaces/
  18. ## How do I add my bot to my server/guild?
  19. The [OAuth2 URL](https://discordapp.com/developers/tools/oauth2-url-generator)
  20. can be generated via the Discord developer page. This allows you to
  21. set the permissions that the bot will be added with. With this method,
  22. bots will also be assigned their own special roles that normal users
  23. cannot use, which is what we call a `Managed` role.
  24. ## What is a Client/User/Object ID? Is it the token?
  25. Each user and object on Discord has its own snowflake ID generated
  26. based on various conditions.
  27. ![Snowflake Generation](images/snowflake.png)
  28. The ID can be seen by anyone; it is public. It is merely used to
  29. identify an object in the Discord ecosystem. Many things in the
  30. library require an ID to retrieve the said object.
  31. There are 2 ways to obtain the said ID.
  32. 1. Enable Discord's developer mode. With developer mode enabled,
  33. you can - as an example - right click on a guild and copy the guild
  34. id (please note that this does not apply to Role IDs, see below).
  35. ![Developer Mode](images/dev-mode.png)
  36. 2. Escape the object using `\` in front the object. For example,
  37. when you do `\@Example#1234` in chat, it will return the user ID of
  38. the aforementioned user.
  39. A token is a credential used to log into an account. This information
  40. should be kept **private** and for your eyes only. Anyone with your
  41. token can log into your account. This applies to both user and bot
  42. accounts. That also means that you should never ever hardcode your
  43. token or add it into source control, as your identity may be stolen
  44. by scrape bots on the internet that scours through constantly to
  45. obtain a token.
  46. ## How do I get the role ID?
  47. Several common ways to do this:
  48. 1. Make the role mentionable and mention the role, and escape it
  49. using the `\` character in front.
  50. 2. Inspect the roles collection within the guild via your debugger.
  51. Please note that right-clicking on the role and copying the ID will
  52. **not** work. It will only copy the message ID.
  53. ## I have more questions!
  54. Please visit us at #dotnet_discord-net at [Discord API].
  55. Describe the problem in details to us, and preferably with the
  56. problematic code uploaded onto [Hastebin](https://hastebin.com).
  57. [Discord API]: https://discord.gg/jkrBmQR