@@ -90,6 +90,10 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
UseVAD = 0x02_00_00_00, | UseVAD = 0x02_00_00_00, | ||||
PrioritySpeaker = 0x00_00_01_00, | PrioritySpeaker = 0x00_00_01_00, | ||||
/// <summary> | |||||
/// Allows video streaming in a voice channel. | |||||
/// </summary> | |||||
Stream = 0x00_00_02_00, | |||||
// More General | // More General | ||||
/// <summary> | /// <summary> | ||||
@@ -13,7 +13,7 @@ namespace Discord | |||||
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for text channels. </summary> | /// <summary> Gets a <see cref="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 <see cref="ChannelPermissions"/> that grants all permissions for voice channels. </summary> | /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for voice channels. </summary> | ||||
public static readonly ChannelPermissions Voice = new ChannelPermissions(0b00100_1111110_0000000010100_010001); | |||||
public static readonly ChannelPermissions Voice = new ChannelPermissions(0b00100_1111110_0000000011100_010001); | |||||
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for category channels. </summary> | /// <summary> Gets a <see cref="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 <see cref="ChannelPermissions"/> that grants all permissions for direct message channels. </summary> | /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for direct message channels. </summary> | ||||
@@ -82,6 +82,8 @@ namespace Discord | |||||
public bool UseVAD => Permissions.GetValue(RawValue, ChannelPermission.UseVAD); | public bool UseVAD => Permissions.GetValue(RawValue, ChannelPermission.UseVAD); | ||||
/// <summary> If <c>true</c>, a user may use priority speaker in a voice channel. </summary> | /// <summary> If <c>true</c>, a user may use priority speaker in a voice channel. </summary> | ||||
public bool PrioritySpeaker => Permissions.GetValue(RawValue, ChannelPermission.PrioritySpeaker); | public bool PrioritySpeaker => Permissions.GetValue(RawValue, ChannelPermission.PrioritySpeaker); | ||||
/// <summary> If <c>true</c>, a user may stream video in a voice channel. </summary> | |||||
public bool Stream => Permissions.GetValue(RawValue, ChannelPermission.Stream); | |||||
/// <summary> If <c>true</c>, a user may adjust role permissions. This also implictly grants all other permissions. </summary> | /// <summary> If <c>true</c>, 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); | ||||
@@ -111,6 +113,7 @@ namespace Discord | |||||
bool? moveMembers = null, | bool? moveMembers = null, | ||||
bool? useVoiceActivation = null, | bool? useVoiceActivation = null, | ||||
bool? prioritySpeaker = null, | bool? prioritySpeaker = null, | ||||
bool? stream = null, | |||||
bool? manageRoles = null, | bool? manageRoles = null, | ||||
bool? manageWebhooks = null) | bool? manageWebhooks = null) | ||||
{ | { | ||||
@@ -135,6 +138,7 @@ namespace Discord | |||||
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, prioritySpeaker, ChannelPermission.PrioritySpeaker); | ||||
Permissions.SetValue(ref value, stream, ChannelPermission.Stream); | |||||
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); | ||||
@@ -162,11 +166,12 @@ namespace Discord | |||||
bool moveMembers = false, | bool moveMembers = false, | ||||
bool useVoiceActivation = false, | bool useVoiceActivation = false, | ||||
bool prioritySpeaker = false, | bool prioritySpeaker = false, | ||||
bool stream = 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, prioritySpeaker, manageRoles, manageWebhooks) | |||||
speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, prioritySpeaker, stream, manageRoles, manageWebhooks) | |||||
{ } | { } | ||||
/// <summary> Creates a new <see cref="ChannelPermissions"/> from this one, changing the provided non-null permissions. </summary> | /// <summary> Creates a new <see cref="ChannelPermissions"/> from this one, changing the provided non-null permissions. </summary> | ||||
@@ -190,6 +195,7 @@ namespace Discord | |||||
bool? moveMembers = null, | bool? moveMembers = null, | ||||
bool? useVoiceActivation = null, | bool? useVoiceActivation = null, | ||||
bool? prioritySpeaker = null, | bool? prioritySpeaker = null, | ||||
bool? stream = null, | |||||
bool? manageRoles = null, | bool? manageRoles = null, | ||||
bool? manageWebhooks = null) | bool? manageWebhooks = null) | ||||
=> new ChannelPermissions(RawValue, | => new ChannelPermissions(RawValue, | ||||
@@ -212,6 +218,7 @@ namespace Discord | |||||
moveMembers, | moveMembers, | ||||
useVoiceActivation, | useVoiceActivation, | ||||
prioritySpeaker, | prioritySpeaker, | ||||
stream, | |||||
manageRoles, | manageRoles, | ||||
manageWebhooks); | manageWebhooks); | ||||
@@ -126,6 +126,10 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
UseVAD = 0x02_00_00_00, | UseVAD = 0x02_00_00_00, | ||||
PrioritySpeaker = 0x00_00_01_00, | PrioritySpeaker = 0x00_00_01_00, | ||||
/// <summary> | |||||
/// Allows video streaming in a voice channel. | |||||
/// </summary> | |||||
Stream = 0x00_00_02_00, | |||||
// General 2 | // General 2 | ||||
/// <summary> | /// <summary> | ||||
@@ -12,7 +12,7 @@ namespace Discord | |||||
/// <summary> Gets a <see cref="GuildPermissions"/> that grants all guild permissions for webhook users. </summary> | /// <summary> Gets a <see cref="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 <see cref="GuildPermissions"/> that grants all guild permissions. </summary> | /// <summary> Gets a <see cref="GuildPermissions"/> that grants all guild permissions. </summary> | ||||
public static readonly GuildPermissions All = new GuildPermissions(0b11111_1111110_1111111110111_111111); | |||||
public static readonly GuildPermissions All = new GuildPermissions(0b11111_1111110_1111111111111_111111); | |||||
/// <summary> Gets a packed value representing all the permissions in this <see cref="GuildPermissions"/>. </summary> | /// <summary> Gets a packed value representing all the permissions in this <see cref="GuildPermissions"/>. </summary> | ||||
public ulong RawValue { get; } | public ulong RawValue { get; } | ||||
@@ -70,7 +70,9 @@ namespace Discord | |||||
/// <summary> If <c>true</c>, a user may use voice-activity-detection rather than push-to-talk. </summary> | /// <summary> If <c>true</c>, 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> | /// <summary> If True, a user may use priority speaker in a voice channel. </summary> | ||||
public bool PrioritySpeaker => Permissions.GetValue(RawValue, ChannelPermission.PrioritySpeaker); | |||||
public bool PrioritySpeaker => Permissions.GetValue(RawValue, GuildPermission.PrioritySpeaker); | |||||
/// <summary> If True, a user may stream video in a voice channel. </summary> | |||||
public bool Stream => Permissions.GetValue(RawValue, GuildPermission.Stream); | |||||
/// <summary> If <c>true</c>, a user may change their own nickname. </summary> | /// <summary> If <c>true</c>, a user may change their own nickname. </summary> | ||||
public bool ChangeNickname => Permissions.GetValue(RawValue, GuildPermission.ChangeNickname); | public bool ChangeNickname => Permissions.GetValue(RawValue, GuildPermission.ChangeNickname); | ||||
@@ -111,6 +113,7 @@ namespace Discord | |||||
bool? moveMembers = null, | bool? moveMembers = null, | ||||
bool? useVoiceActivation = null, | bool? useVoiceActivation = null, | ||||
bool? prioritySpeaker = null, | bool? prioritySpeaker = null, | ||||
bool? stream = null, | |||||
bool? changeNickname = null, | bool? changeNickname = null, | ||||
bool? manageNicknames = null, | bool? manageNicknames = null, | ||||
bool? manageRoles = null, | bool? manageRoles = null, | ||||
@@ -143,6 +146,7 @@ namespace Discord | |||||
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, prioritySpeaker, GuildPermission.PrioritySpeaker); | ||||
Permissions.SetValue(ref value, stream, GuildPermission.Stream); | |||||
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); | ||||
@@ -178,6 +182,7 @@ namespace Discord | |||||
bool moveMembers = false, | bool moveMembers = false, | ||||
bool useVoiceActivation = false, | bool useVoiceActivation = false, | ||||
bool prioritySpeaker = false, | bool prioritySpeaker = false, | ||||
bool stream = false, | |||||
bool changeNickname = false, | bool changeNickname = false, | ||||
bool manageNicknames = false, | bool manageNicknames = false, | ||||
bool manageRoles = false, | bool manageRoles = false, | ||||
@@ -209,6 +214,7 @@ namespace Discord | |||||
moveMembers: moveMembers, | moveMembers: moveMembers, | ||||
useVoiceActivation: useVoiceActivation, | useVoiceActivation: useVoiceActivation, | ||||
prioritySpeaker: prioritySpeaker, | prioritySpeaker: prioritySpeaker, | ||||
stream: stream, | |||||
changeNickname: changeNickname, | changeNickname: changeNickname, | ||||
manageNicknames: manageNicknames, | manageNicknames: manageNicknames, | ||||
manageWebhooks: manageWebhooks, | manageWebhooks: manageWebhooks, | ||||
@@ -241,6 +247,7 @@ namespace Discord | |||||
bool? moveMembers = null, | bool? moveMembers = null, | ||||
bool? useVoiceActivation = null, | bool? useVoiceActivation = null, | ||||
bool? prioritySpeaker = null, | bool? prioritySpeaker = null, | ||||
bool? stream = null, | |||||
bool? changeNickname = null, | bool? changeNickname = null, | ||||
bool? manageNicknames = null, | bool? manageNicknames = null, | ||||
bool? manageRoles = null, | bool? manageRoles = null, | ||||
@@ -249,7 +256,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, prioritySpeaker, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojis); | |||||
useVoiceActivation, prioritySpeaker, stream, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojis); | |||||
/// <summary> | /// <summary> | ||||
/// Returns a value that indicates if a specific <see cref="GuildPermission"/> is enabled | /// Returns a value that indicates if a specific <see cref="GuildPermission"/> is enabled | ||||
@@ -82,6 +82,7 @@ namespace Discord | |||||
AssertFlag(() => new ChannelPermissions(moveMembers: true), ChannelPermission.MoveMembers); | AssertFlag(() => new ChannelPermissions(moveMembers: true), ChannelPermission.MoveMembers); | ||||
AssertFlag(() => new ChannelPermissions(useVoiceActivation: true), ChannelPermission.UseVAD); | AssertFlag(() => new ChannelPermissions(useVoiceActivation: true), ChannelPermission.UseVAD); | ||||
AssertFlag(() => new ChannelPermissions(prioritySpeaker: true), ChannelPermission.PrioritySpeaker); | AssertFlag(() => new ChannelPermissions(prioritySpeaker: true), ChannelPermission.PrioritySpeaker); | ||||
AssertFlag(() => new ChannelPermissions(stream: true), ChannelPermission.Stream); | |||||
AssertFlag(() => new ChannelPermissions(manageRoles: true), ChannelPermission.ManageRoles); | AssertFlag(() => new ChannelPermissions(manageRoles: true), ChannelPermission.ManageRoles); | ||||
AssertFlag(() => new ChannelPermissions(manageWebhooks: true), ChannelPermission.ManageWebhooks); | AssertFlag(() => new ChannelPermissions(manageWebhooks: true), ChannelPermission.ManageWebhooks); | ||||
} | } | ||||
@@ -147,6 +148,7 @@ namespace Discord | |||||
AssertUtil(ChannelPermission.ManageRoles, x => x.ManageRoles, (p, enable) => p.Modify(manageRoles: enable)); | AssertUtil(ChannelPermission.ManageRoles, x => x.ManageRoles, (p, enable) => p.Modify(manageRoles: enable)); | ||||
AssertUtil(ChannelPermission.ManageWebhooks, x => x.ManageWebhooks, (p, enable) => p.Modify(manageWebhooks: enable)); | AssertUtil(ChannelPermission.ManageWebhooks, x => x.ManageWebhooks, (p, enable) => p.Modify(manageWebhooks: enable)); | ||||
AssertUtil(ChannelPermission.PrioritySpeaker, x => x.PrioritySpeaker, (p, enable) => p.Modify(prioritySpeaker: enable)); | AssertUtil(ChannelPermission.PrioritySpeaker, x => x.PrioritySpeaker, (p, enable) => p.Modify(prioritySpeaker: enable)); | ||||
AssertUtil(ChannelPermission.Stream, x => x.Stream, (p, enable) => p.Modify(stream: enable)); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -85,6 +85,7 @@ namespace Discord | |||||
AssertFlag(() => new GuildPermissions(moveMembers: true), GuildPermission.MoveMembers); | AssertFlag(() => new GuildPermissions(moveMembers: true), GuildPermission.MoveMembers); | ||||
AssertFlag(() => new GuildPermissions(useVoiceActivation: true), GuildPermission.UseVAD); | AssertFlag(() => new GuildPermissions(useVoiceActivation: true), GuildPermission.UseVAD); | ||||
AssertFlag(() => new GuildPermissions(prioritySpeaker: true), GuildPermission.PrioritySpeaker); | AssertFlag(() => new GuildPermissions(prioritySpeaker: true), GuildPermission.PrioritySpeaker); | ||||
AssertFlag(() => new GuildPermissions(stream: true), GuildPermission.Stream); | |||||
AssertFlag(() => new GuildPermissions(changeNickname: true), GuildPermission.ChangeNickname); | AssertFlag(() => new GuildPermissions(changeNickname: true), GuildPermission.ChangeNickname); | ||||
AssertFlag(() => new GuildPermissions(manageNicknames: true), GuildPermission.ManageNicknames); | AssertFlag(() => new GuildPermissions(manageNicknames: true), GuildPermission.ManageNicknames); | ||||
AssertFlag(() => new GuildPermissions(manageRoles: true), GuildPermission.ManageRoles); | AssertFlag(() => new GuildPermissions(manageRoles: true), GuildPermission.ManageRoles); | ||||