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
name
stringName of the role.
permissions
DiscordPermissions?Permissions for the role.
color
DiscordColor?Color for the role.
hoist
bool?Whether the role is to be hoisted.
mentionable
bool?Whether the role is to be mentionable.
reason
stringReason for audit logs.
icon
StreamThe icon to add to this role
emoji
DiscordEmojiThe 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.