Struct ChannelPermissions
- Namespace
- Kook
- Assembly
- Kook.Net.Core.dll
Represents a set of permissions for a channel.
public struct ChannelPermissions
- Inherited Members
Constructors
ChannelPermissions(bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?)
Creates a new ChannelPermissions with the provided permissions.
public ChannelPermissions(bool? createInvites = false, bool? manageChannels = false, bool? manageRoles = false, bool? viewChannel = false, bool? sendMessages = false, bool? manageMessages = false, bool? attachFiles = false, bool? connect = false, bool? manageVoice = false, bool? mentionEveryone = false, bool? addReactions = false, bool? passiveConnect = false, bool? useVoiceActivity = false, bool? speak = false, bool? deafenMembers = false, bool? muteMembers = false, bool? playSoundtrack = false, bool? shareScreen = false)
Parameters
createInvites
bool?manageChannels
bool?manageRoles
bool?viewChannel
bool?sendMessages
bool?manageMessages
bool?attachFiles
bool?connect
bool?manageVoice
bool?mentionEveryone
bool?addReactions
bool?passiveConnect
bool?useVoiceActivity
bool?speak
bool?deafenMembers
bool?muteMembers
bool?playSoundtrack
bool?shareScreen
bool?
ChannelPermissions(ulong)
Creates a new ChannelPermissions with the provided packed value.
public ChannelPermissions(ulong rawValue)
Parameters
rawValue
ulong
Fields
Category
Gets a ChannelPermissions that grants all permissions for category channels.
public static readonly ChannelPermissions Category
Field Value
DM
Gets a ChannelPermissions that grants all permissions for direct message channels.
public static readonly ChannelPermissions DM
Field Value
None
Gets a blank ChannelPermissions that grants no permissions.
public static readonly ChannelPermissions None
Field Value
Text
Gets a ChannelPermissions that grants all permissions for text channels.
public static readonly ChannelPermissions Text
Field Value
Voice
Gets a ChannelPermissions that grants all permissions for voice channels.
public static readonly ChannelPermissions Voice
Field Value
Properties
AddReactions
If true
, a user may add reactions.
public bool AddReactions { get; }
Property Value
AttachFiles
If true
, a user may send files.
public bool AttachFiles { get; }
Property Value
Connect
If true
, a user may connect to a voice channel.
public bool Connect { get; }
Property Value
CreateInvites
If true
, a user may create invites.
public bool CreateInvites { get; }
Property Value
DeafenMembers
If true
, a user may deafen users.
public bool DeafenMembers { get; }
Property Value
ManageChannels
If true
, a user may view and revoke invites.
public bool ManageChannels { get; }
Property Value
ManageMessages
If true
, a user may delete messages.
public bool ManageMessages { get; }
Property Value
ManageRoles
If true
, a user may adjust roles.
public bool ManageRoles { get; }
Property Value
ManageVoice
If true
, a user may kick other users from voice channels, and move other users between voice channels.
public bool ManageVoice { get; }
Property Value
MentionEveryone
If true
, a user may mention all users.
public bool MentionEveryone { get; }
Property Value
MuteMembers
If true
, a user may mute users.
public bool MuteMembers { get; }
Property Value
PassiveConnect
If true
, a user may connect to a voice channel only when the user is invited or moved by other users.
public bool PassiveConnect { get; }
Property Value
PlaySoundtrack
If true
, a user may play soundtracks in a voice channel.
public bool PlaySoundtrack { get; }
Property Value
RawValue
Gets a packed value representing all the permissions in this ChannelPermissions.
public readonly ulong RawValue { get; }
Property Value
SendMessages
If true
, a user may send messages.
public bool SendMessages { get; }
Property Value
ShareScreen
If true
, a user may share screen in a voice channel.
public bool ShareScreen { get; }
Property Value
Speak
If true
, a user may speak in a voice channel.
public bool Speak { get; }
Property Value
UseVoiceActivity
If true
, a user may use voice activation.
public bool UseVoiceActivity { get; }
Property Value
ViewChannel
If true
, a user may view channels.
public bool ViewChannel { get; }
Property Value
Methods
All(IChannel)
Gets a ChannelPermissions that grants all permissions for a given channel type.
public static ChannelPermissions All(IChannel channel)
Parameters
channel
IChannel
Returns
Exceptions
- ArgumentException
Unknown channel type.
Has(ChannelPermission)
Returns a value that indicates if a specific ChannelPermission is enabled in these permissions.
public bool Has(ChannelPermission permission)
Parameters
permission
ChannelPermissionThe permission value to check for.
Returns
- bool
true
if the permission is enabled,false
otherwise.
Modify(bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?, bool?)
Creates a new ChannelPermissions from this one, changing the provided non-null permissions.
public ChannelPermissions Modify(bool? createInvites = null, bool? manageChannels = null, bool? manageRoles = null, bool? viewChannel = null, bool? sendMessages = null, bool? manageMessages = null, bool? attachFiles = null, bool? connect = null, bool? manageVoice = null, bool? mentionEveryone = null, bool? addReactions = null, bool? passiveConnect = null, bool? useVoiceActivity = null, bool? speak = null, bool? deafenMembers = null, bool? muteMembers = null, bool? playSoundtrack = null, bool? shareScreen = null)
Parameters
createInvites
bool?manageChannels
bool?manageRoles
bool?viewChannel
bool?sendMessages
bool?manageMessages
bool?attachFiles
bool?connect
bool?manageVoice
bool?mentionEveryone
bool?addReactions
bool?passiveConnect
bool?useVoiceActivity
bool?speak
bool?deafenMembers
bool?muteMembers
bool?playSoundtrack
bool?shareScreen
bool?
Returns
ToList()
Returns a List<T> containing all of the ChannelPermission flags that are enabled.
public List<ChannelPermission> ToList()
Returns
- List<ChannelPermission>
A List<T> containing ChannelPermission flags. Empty if none are enabled.
ToString()
Gets the raw value of the permissions.
public override string ToString()