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.

server-management.rst 1.9 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. Server Management
  2. =================
  3. Discord.Net will allow you to manage most settings of a Discord server.
  4. Usage
  5. -----
  6. You can create Channels, Invites, and Roles on a server using the CreateChannel, CreateInvite, and CreateRole function of a Server, respectively.
  7. You may also edit a server's name, icon, and region.
  8. .. code-block:: c#
  9. // Create a Channel and retrieve the Channel object
  10. var _channel = await _server.CreateChannel("announcements", ChannelType.Text);
  11. // Create an Invite and retrieve the Invite object
  12. var _invite = await _server.CreateInvite(maxAge: null, maxUses: 25, tempMembership: false, withXkcd: false);
  13. // Create a Role and retrieve the Role object
  14. var _role = await _server.CreateRole(name: "Bots", permissions: null, color: Color.DarkMagenta, isHoisted: false);
  15. // Edit a server
  16. var _ioStream = new System.IO.StreamReader("clock-0500-1952.png").BaseStream
  17. _server.Edit(name: "19:52 | UTC-05:00", region: "east", icon: _ioStream, iconType: ImageType.Png);
  18. // Prune Users
  19. var _pruneCount = await _server.PruneUsers(30, true);
  20. Invite Parameters
  21. -----------------
  22. maxAge: The time (in seconds) until the invite expires. Use null for infinite.
  23. maxUses: The maximum amount of uses the invite has before it expires.
  24. tempMembership: Whether or not to kick a user when they disconnect.
  25. withXkcd: Generate the invite with an XKCD 936 style URL
  26. Role Parameters
  27. ---------------
  28. name: The name of the role
  29. permissions: A set of ServerPermissions for the role to use by default
  30. color: The color of the role, recommended to use Discord.Color
  31. isHoisted: Whether a role's users should be displayed separately from other users in the user list.
  32. Edit Parameters
  33. ---------------
  34. name: The server's name
  35. region: The region the voice server is hosted in
  36. icon: A System.IO.Stream that will read an image file
  37. iconType: The type of image being sent (png/jpeg).