Struct DiscordPermissions
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
Represents a set of Discord permissions.
[JsonConverter(typeof(DiscordPermissionsAsStringJsonConverter))]
public readonly struct DiscordPermissions
Constructors
- DiscordPermissions(DiscordPermission)
Creates a new instance of this type from exactly the specified permission.
- DiscordPermissions(params IReadOnlyList<DiscordPermission>)
Creates a new instance of this type from the specified permissions.
- DiscordPermissions(BigInteger)
Creates a new instance of this type from the specified big integer. This assumes that the data is unsigned.
- DiscordPermissions(params ReadOnlySpan<DiscordPermission>)
Creates a new instance of this type from the specified permissions.
- DiscordPermissions(scoped ReadOnlySpan<byte>)
Creates a new instance of this type from the specified raw data. This assumes that the data is unsigned.
Properties
- All
Returns a Discord permission set with all documented permissions set to true.
- AllBitsSet
Returns a full Discord permission set with all flags set to true.
- None
Returns an empty Discord permission set.
Methods
- Add(DiscordPermission)
Adds a permission to this permission set.
- Add(params ReadOnlySpan<DiscordPermission>)
Adds multiple permissions to this permission set.
- EnumeratePermissions()
Provides an enumeration of all permissions specified by this set.
- Equals(DiscordPermissions)
Determines whether this Discord permission set is equal to the provided Discord permission set.
- Equals(object?)
Determines whether this Discord permission set is equal to the provided object.
- GetHashCode()
Calculates a hash code for this Discord permission set. The hash code is only guaranteed to be consistent within a process, and sharing this data across process boundaries is dangerous.
- HasAllPermissions(DiscordPermissions)
Returns whether all of the specified permissions are gratned, either directly or through Administrator permissions.
- HasAllPermissions(params ReadOnlySpan<DiscordPermission>)
Returns whether all of the specified permissions are gratned, either directly or through Administrator permissions.
- HasAnyPermission(DiscordPermissions)
Returns whether any of the specified permissions are granted, either directly or through Administrator permissions.
- HasAnyPermission(params ReadOnlySpan<DiscordPermission>)
Returns whether any of the specified permissions are granted, either directly or through Administrator permissions.
- HasFlag(DiscordPermission)
Returns whether the specified permission is set explicitly.
- HasPermission(DiscordPermission)
Returns whether the specified permission is granted, either directly or through Administrator permissions.
- Remove(DiscordPermission)
Removes a permission from this permission set.
- Remove(params ReadOnlySpan<DiscordPermission>)
Removes multiple permission from this permission set.
- ToString()
Returns a string representation of this permission set.
- ToString(string)
Returns a string representation of this permission set, according to the provided format string.
- Toggle(DiscordPermission)
Toggles the specified permission between states.
- Toggle(params ReadOnlySpan<DiscordPermission>)
Toggles all of the specified permissions between states.
Operators
- operator +(DiscordPermissions, DiscordPermission)
Adds the specified permission to the permission set.
- operator &(DiscordPermissions, DiscordPermission)
Returns a permission set containing either no value if the flag was not found, or exactly the specified flag if it was.
- operator &(DiscordPermissions, DiscordPermissions)
Performs a bitwise AND between the two permission sets.
- operator |(DiscordPermissions, DiscordPermission)
Adds the specified permission to the permission set.
- operator |(DiscordPermissions, DiscordPermissions)
Merges both permission sets into one, taking all set permissions from both.
- operator ^(DiscordPermissions, DiscordPermission)
Toggles the specified flag in the permission set.
- operator ^(DiscordPermissions, DiscordPermissions)
Performs a bitwise XOR operation between the two permission sets.
- operator ~(DiscordPermissions)
Negates the specified permission set.
- operator -(DiscordPermissions, DiscordPermission)
Removes the specified permission from a permission set.
- operator -(DiscordPermissions, DiscordPermissions)
Removes all permissions specified in the right-hand set from the left-hand set and returns the new permission set.