Method CreateRoleAsync
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
CreateRoleAsync(string?, DiscordPermissions?, DiscordColor?, bool?, bool?, string?, Stream?, DiscordEmoji?)
Creates a new role in this guild.
public Task<DiscordRole> CreateRoleAsync(string? name = null, DiscordPermissions? permissions = null, DiscordColor? color = null, bool? hoist = null, bool? mentionable = null, string? reason = null, Stream? icon = null, DiscordEmoji? emoji = null)
Parameters
namestringName of the role.
permissionsDiscordPermissions?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.
iconStreamThe icon to add to this role
emojiDiscordEmojiThe emoji to add to this role. Must be unicode.
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.