| @@ -1,4 +1,4 @@ | |||||
| using System; | |||||
| using System; | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| @@ -30,6 +30,7 @@ namespace Discord | |||||
| DeafenMembers = 0x00_80_00_00, | DeafenMembers = 0x00_80_00_00, | ||||
| MoveMembers = 0x01_00_00_00, | MoveMembers = 0x01_00_00_00, | ||||
| UseVAD = 0x02_00_00_00, | UseVAD = 0x02_00_00_00, | ||||
| PrioritySpeaker = 0x00_00_01_00, | |||||
| // More General | // More General | ||||
| ManageRoles = 0x10_00_00_00, | ManageRoles = 0x10_00_00_00, | ||||
| @@ -12,7 +12,7 @@ namespace Discord | |||||
| /// <summary> Gets a ChannelPermissions that grants all permissions for text channels. </summary> | /// <summary> Gets a ChannelPermissions that grants all permissions for text channels. </summary> | ||||
| public static readonly ChannelPermissions Text = new ChannelPermissions(0b01100_0000000_1111111110001_010001); | public static readonly ChannelPermissions Text = new ChannelPermissions(0b01100_0000000_1111111110001_010001); | ||||
| /// <summary> Gets a ChannelPermissions that grants all permissions for voice channels. </summary> | /// <summary> Gets a ChannelPermissions that grants all permissions for voice channels. </summary> | ||||
| public static readonly ChannelPermissions Voice = new ChannelPermissions(0b00100_1111110_0000000010000_010001); | |||||
| public static readonly ChannelPermissions Voice = new ChannelPermissions(0b00100_1111110_0000000010100_010001); | |||||
| /// <summary> Gets a ChannelPermissions that grants all permissions for category channels. </summary> | /// <summary> Gets a ChannelPermissions that grants all permissions for category channels. </summary> | ||||
| public static readonly ChannelPermissions Category = new ChannelPermissions(0b01100_1111110_1111111110001_010001); | public static readonly ChannelPermissions Category = new ChannelPermissions(0b01100_1111110_1111111110001_010001); | ||||
| /// <summary> Gets a ChannelPermissions that grants all permissions for direct message channels. </summary> | /// <summary> Gets a ChannelPermissions that grants all permissions for direct message channels. </summary> | ||||
| @@ -78,6 +78,8 @@ namespace Discord | |||||
| public bool MoveMembers => Permissions.GetValue(RawValue, ChannelPermission.MoveMembers); | public bool MoveMembers => Permissions.GetValue(RawValue, ChannelPermission.MoveMembers); | ||||
| /// <summary> If True, a user may use voice-activity-detection rather than push-to-talk. </summary> | /// <summary> If True, a user may use voice-activity-detection rather than push-to-talk. </summary> | ||||
| public bool UseVAD => Permissions.GetValue(RawValue, ChannelPermission.UseVAD); | public bool UseVAD => Permissions.GetValue(RawValue, ChannelPermission.UseVAD); | ||||
| /// <summary> If True, a user may use priority speaker in a voice channel. </summary> | |||||
| public bool PrioritySpeaker => Permissions.GetValue(RawValue, ChannelPermission.PrioritySpeaker); | |||||
| /// <summary> If True, a user may adjust role permissions. This also implictly grants all other permissions. </summary> | /// <summary> If True, a user may adjust role permissions. This also implictly grants all other permissions. </summary> | ||||
| public bool ManageRoles => Permissions.GetValue(RawValue, ChannelPermission.ManageRoles); | public bool ManageRoles => Permissions.GetValue(RawValue, ChannelPermission.ManageRoles); | ||||
| @@ -106,6 +108,7 @@ namespace Discord | |||||
| bool? deafenMembers = null, | bool? deafenMembers = null, | ||||
| bool? moveMembers = null, | bool? moveMembers = null, | ||||
| bool? useVoiceActivation = null, | bool? useVoiceActivation = null, | ||||
| bool? prioritySpeaker = null, | |||||
| bool? manageRoles = null, | bool? manageRoles = null, | ||||
| bool? manageWebhooks = null) | bool? manageWebhooks = null) | ||||
| { | { | ||||
| @@ -129,6 +132,7 @@ namespace Discord | |||||
| Permissions.SetValue(ref value, deafenMembers, ChannelPermission.DeafenMembers); | Permissions.SetValue(ref value, deafenMembers, ChannelPermission.DeafenMembers); | ||||
| Permissions.SetValue(ref value, moveMembers, ChannelPermission.MoveMembers); | Permissions.SetValue(ref value, moveMembers, ChannelPermission.MoveMembers); | ||||
| Permissions.SetValue(ref value, useVoiceActivation, ChannelPermission.UseVAD); | Permissions.SetValue(ref value, useVoiceActivation, ChannelPermission.UseVAD); | ||||
| Permissions.SetValue(ref value, prioritySpeaker, ChannelPermission.PrioritySpeaker); | |||||
| Permissions.SetValue(ref value, manageRoles, ChannelPermission.ManageRoles); | Permissions.SetValue(ref value, manageRoles, ChannelPermission.ManageRoles); | ||||
| Permissions.SetValue(ref value, manageWebhooks, ChannelPermission.ManageWebhooks); | Permissions.SetValue(ref value, manageWebhooks, ChannelPermission.ManageWebhooks); | ||||
| @@ -155,11 +159,12 @@ namespace Discord | |||||
| bool deafenMembers = false, | bool deafenMembers = false, | ||||
| bool moveMembers = false, | bool moveMembers = false, | ||||
| bool useVoiceActivation = false, | bool useVoiceActivation = false, | ||||
| bool prioritySpeaker = false, | |||||
| bool manageRoles = false, | bool manageRoles = false, | ||||
| bool manageWebhooks = false) | bool manageWebhooks = false) | ||||
| : this(0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages, | : this(0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages, | ||||
| embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, | embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, | ||||
| speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, manageRoles, manageWebhooks) | |||||
| speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, prioritySpeaker, manageRoles, manageWebhooks) | |||||
| { } | { } | ||||
| /// <summary> Creates a new ChannelPermissions from this one, changing the provided non-null permissions. </summary> | /// <summary> Creates a new ChannelPermissions from this one, changing the provided non-null permissions. </summary> | ||||
| @@ -182,6 +187,7 @@ namespace Discord | |||||
| bool? deafenMembers = null, | bool? deafenMembers = null, | ||||
| bool? moveMembers = null, | bool? moveMembers = null, | ||||
| bool? useVoiceActivation = null, | bool? useVoiceActivation = null, | ||||
| bool? prioritySpeaker = null, | |||||
| bool? manageRoles = null, | bool? manageRoles = null, | ||||
| bool? manageWebhooks = null) | bool? manageWebhooks = null) | ||||
| => new ChannelPermissions(RawValue, | => new ChannelPermissions(RawValue, | ||||
| @@ -203,6 +209,7 @@ namespace Discord | |||||
| deafenMembers, | deafenMembers, | ||||
| moveMembers, | moveMembers, | ||||
| useVoiceActivation, | useVoiceActivation, | ||||
| prioritySpeaker, | |||||
| manageRoles, | manageRoles, | ||||
| manageWebhooks); | manageWebhooks); | ||||
| @@ -35,6 +35,7 @@ namespace Discord | |||||
| DeafenMembers = 0x00_80_00_00, | DeafenMembers = 0x00_80_00_00, | ||||
| MoveMembers = 0x01_00_00_00, | MoveMembers = 0x01_00_00_00, | ||||
| UseVAD = 0x02_00_00_00, | UseVAD = 0x02_00_00_00, | ||||
| PrioritySpeaker = 0x00_00_01_00, | |||||
| // General 2 | // General 2 | ||||
| ChangeNickname = 0x04_00_00_00, | ChangeNickname = 0x04_00_00_00, | ||||
| @@ -12,7 +12,7 @@ namespace Discord | |||||
| /// <summary> Gets a GuildPermissions that grants all guild permissions for webhook users. </summary> | /// <summary> Gets a GuildPermissions that grants all guild permissions for webhook users. </summary> | ||||
| public static readonly GuildPermissions Webhook = new GuildPermissions(0b00000_0000000_0001101100000_000000); | public static readonly GuildPermissions Webhook = new GuildPermissions(0b00000_0000000_0001101100000_000000); | ||||
| /// <summary> Gets a GuildPermissions that grants all guild permissions. </summary> | /// <summary> Gets a GuildPermissions that grants all guild permissions. </summary> | ||||
| public static readonly GuildPermissions All = new GuildPermissions(0b11111_1111110_1111111110011_111111); | |||||
| public static readonly GuildPermissions All = new GuildPermissions(0b11111_1111110_1111111110111_111111); | |||||
| /// <summary> Gets a packed value representing all the permissions in this GuildPermissions. </summary> | /// <summary> Gets a packed value representing all the permissions in this GuildPermissions. </summary> | ||||
| public ulong RawValue { get; } | public ulong RawValue { get; } | ||||
| @@ -69,6 +69,8 @@ namespace Discord | |||||
| public bool MoveMembers => Permissions.GetValue(RawValue, GuildPermission.MoveMembers); | public bool MoveMembers => Permissions.GetValue(RawValue, GuildPermission.MoveMembers); | ||||
| /// <summary> If True, a user may use voice-activity-detection rather than push-to-talk. </summary> | /// <summary> If True, a user may use voice-activity-detection rather than push-to-talk. </summary> | ||||
| public bool UseVAD => Permissions.GetValue(RawValue, GuildPermission.UseVAD); | public bool UseVAD => Permissions.GetValue(RawValue, GuildPermission.UseVAD); | ||||
| /// <summary> If True, a user may use priority speaker in a voice channel. </summary> | |||||
| public bool PrioritySpeaker => Permissions.GetValue(RawValue, ChannelPermission.PrioritySpeaker); | |||||
| /// <summary> If True, a user may change their own nickname. </summary> | /// <summary> If True, a user may change their own nickname. </summary> | ||||
| public bool ChangeNickname => Permissions.GetValue(RawValue, GuildPermission.ChangeNickname); | public bool ChangeNickname => Permissions.GetValue(RawValue, GuildPermission.ChangeNickname); | ||||
| @@ -108,6 +110,7 @@ namespace Discord | |||||
| bool? deafenMembers = null, | bool? deafenMembers = null, | ||||
| bool? moveMembers = null, | bool? moveMembers = null, | ||||
| bool? useVoiceActivation = null, | bool? useVoiceActivation = null, | ||||
| bool? prioritySpeaker = null, | |||||
| bool? changeNickname = null, | bool? changeNickname = null, | ||||
| bool? manageNicknames = null, | bool? manageNicknames = null, | ||||
| bool? manageRoles = null, | bool? manageRoles = null, | ||||
| @@ -139,6 +142,7 @@ namespace Discord | |||||
| Permissions.SetValue(ref value, deafenMembers, GuildPermission.DeafenMembers); | Permissions.SetValue(ref value, deafenMembers, GuildPermission.DeafenMembers); | ||||
| Permissions.SetValue(ref value, moveMembers, GuildPermission.MoveMembers); | Permissions.SetValue(ref value, moveMembers, GuildPermission.MoveMembers); | ||||
| Permissions.SetValue(ref value, useVoiceActivation, GuildPermission.UseVAD); | Permissions.SetValue(ref value, useVoiceActivation, GuildPermission.UseVAD); | ||||
| Permissions.SetValue(ref value, prioritySpeaker, GuildPermission.PrioritySpeaker); | |||||
| Permissions.SetValue(ref value, changeNickname, GuildPermission.ChangeNickname); | Permissions.SetValue(ref value, changeNickname, GuildPermission.ChangeNickname); | ||||
| Permissions.SetValue(ref value, manageNicknames, GuildPermission.ManageNicknames); | Permissions.SetValue(ref value, manageNicknames, GuildPermission.ManageNicknames); | ||||
| Permissions.SetValue(ref value, manageRoles, GuildPermission.ManageRoles); | Permissions.SetValue(ref value, manageRoles, GuildPermission.ManageRoles); | ||||
| @@ -173,6 +177,7 @@ namespace Discord | |||||
| bool deafenMembers = false, | bool deafenMembers = false, | ||||
| bool moveMembers = false, | bool moveMembers = false, | ||||
| bool useVoiceActivation = false, | bool useVoiceActivation = false, | ||||
| bool prioritySpeaker = false, | |||||
| bool changeNickname = false, | bool changeNickname = false, | ||||
| bool manageNicknames = false, | bool manageNicknames = false, | ||||
| bool manageRoles = false, | bool manageRoles = false, | ||||
| @@ -203,6 +208,7 @@ namespace Discord | |||||
| deafenMembers: deafenMembers, | deafenMembers: deafenMembers, | ||||
| moveMembers: moveMembers, | moveMembers: moveMembers, | ||||
| useVoiceActivation: useVoiceActivation, | useVoiceActivation: useVoiceActivation, | ||||
| prioritySpeaker: prioritySpeaker, | |||||
| changeNickname: changeNickname, | changeNickname: changeNickname, | ||||
| manageNicknames: manageNicknames, | manageNicknames: manageNicknames, | ||||
| manageWebhooks: manageWebhooks, | manageWebhooks: manageWebhooks, | ||||
| @@ -234,6 +240,7 @@ namespace Discord | |||||
| bool? deafenMembers = null, | bool? deafenMembers = null, | ||||
| bool? moveMembers = null, | bool? moveMembers = null, | ||||
| bool? useVoiceActivation = null, | bool? useVoiceActivation = null, | ||||
| bool? prioritySpeaker = null, | |||||
| bool? changeNickname = null, | bool? changeNickname = null, | ||||
| bool? manageNicknames = null, | bool? manageNicknames = null, | ||||
| bool? manageRoles = null, | bool? manageRoles = null, | ||||
| @@ -242,7 +249,7 @@ namespace Discord | |||||
| => new GuildPermissions(RawValue, createInstantInvite, kickMembers, banMembers, administrator, manageChannels, manageGuild, addReactions, | => new GuildPermissions(RawValue, createInstantInvite, kickMembers, banMembers, administrator, manageChannels, manageGuild, addReactions, | ||||
| viewAuditLog, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles, | viewAuditLog, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles, | ||||
| readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers, | readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers, | ||||
| useVoiceActivation, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojis); | |||||
| useVoiceActivation, prioritySpeaker, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojis); | |||||
| public bool Has(GuildPermission permission) => Permissions.GetValue(RawValue, permission); | public bool Has(GuildPermission permission) => Permissions.GetValue(RawValue, permission); | ||||