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

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