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.8 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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], [polymorphism], [interface] and
  8. 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. It is meant to be a template or a guide. It is not
  16. > 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 [permissions 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 Role IDs, see below).
  41. ![Developer Mode](images/dev-mode.png)
  42. 2. Escape the object using `\` in front the object. For example,
  43. when you do `\@Example#1234` in chat, it will return the user ID of
  44. the aforementioned user.
  45. A token is a credential used to log into an account. This information
  46. should be kept **private** and for your eyes only. Anyone with your
  47. token can log into your account. This applies to both user and bot
  48. accounts. That also means that you should never ever hardcode your
  49. token or add it into source control, as your identity may be stolen
  50. by scrape bots on the internet that scours through constantly to
  51. obtain a token.
  52. ## How do I get the role ID?
  53. Several common ways to do this:
  54. 1. Make the role mentionable and mention the role, and escape it
  55. using the `\` character in front.
  56. 2. Inspect the roles collection within the guild via your debugger.
  57. Please note that right-clicking on the role and copying the ID will
  58. **not** work. It will only copy the message ID.
  59. ## I have more questions!
  60. Please visit us at #dotnet_discord-net at [Discord API].
  61. Describe the problem in details to us, and preferably with the
  62. problematic code uploaded onto [Hastebin](https://hastebin.com).
  63. [Discord API]: https://discord.gg/jkrBmQR