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.

GettingStarted.md 3.5 kB

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