Method CreateRoleAsync
- Namespace
- DisCatSharp.Entities
- Assembly
- DisCatSharp.dll
CreateRoleAsync(string, Permissions?, DiscordColor?, bool?, bool?, string, CancellationToken)
Creates a new role in this guild.
public Task<DiscordRole> CreateRoleAsync(string name = null, Permissions? permissions = null, DiscordColor? color = null, bool? hoist = null, bool? mentionable = null, string reason = null, CancellationToken cancellationToken = default)
Parameters
namestringName of the role.
permissionsPermissions?Permissions for the role.
colorDiscordColor?Color for the role.
hoistbool?Whether the role is to be hoisted.
mentionablebool?Whether the role is to be mentionable.
reasonstringReason for audit logs.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
- Task<DiscordRole>
The newly-created role.
Exceptions
- UnauthorizedException
Thrown when the client does not have the ManageRoles permission.
- ServerErrorException
Thrown when Discord is unable to process the request.