Browse Source

Submitting updates to include new permissions. (#195)

* Submitting updates to include new permissions.

* Make old permissions obsolete and update tests

Co-authored-by: quin lynch <lynchquin@gmail.com>
pull/1923/head
drobbins329 GitHub 3 years ago
parent
commit
6457add1b1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 351 additions and 130 deletions
  1. +129
    -49
      src/Discord.Net.Core/Discord.Net.Core.xml
  2. +30
    -2
      src/Discord.Net.Core/Entities/Permissions/ChannelPermission.cs
  3. +102
    -41
      src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
  4. +7
    -2
      src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs
  5. +9
    -23
      src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs
  6. +67
    -5
      src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs
  7. +0
    -1
      src/Discord.Net.Rest/Discord.Net.Rest.xml
  8. +0
    -4
      src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
  9. +4
    -0
      test/Discord.Net.Tests.Unit/ChannelPermissionsTests.cs
  10. +1
    -1
      test/Discord.Net.Tests.Unit/ColorTests.cs
  11. +2
    -2
      test/Discord.Net.Tests.Unit/GuildPermissionsTests.cs

+ 129
- 49
src/Discord.Net.Core/Discord.Net.Core.xml View File

@@ -8267,7 +8267,7 @@
</member> </member>
<member name="P:Discord.ReactionMetadata.IsMe"> <member name="P:Discord.ReactionMetadata.IsMe">
<summary> <summary>
Gets a value that indicates whether the current user has reacted to
Gets a value that indicates whether the current user has reacted to this.
</summary> </summary>
<returns> <returns>
<c>true</c> if the user has reacted to the message; otherwise <c>false</c>. <c>true</c> if the user has reacted to the message; otherwise <c>false</c>.
@@ -8604,7 +8604,12 @@
Allows members to use slash commands in text channels. Allows members to use slash commands in text channels.
</summary> </summary>
</member> </member>
<member name="F:Discord.ChannelPermission.RequesToSpeak">
<member name="F:Discord.ChannelPermission.UseApplicationCommands">
<summary>
Allows members to use slash commands in text channels.
</summary>
</member>
<member name="F:Discord.ChannelPermission.RequestToSpeak">
<summary> <summary>
Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.) Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.)
</summary> </summary>
@@ -8624,106 +8629,158 @@
Allows for creating and participating in private threads Allows for creating and participating in private threads
</summary> </summary>
</member> </member>
<member name="F:Discord.ChannelPermission.CreatePublicThreads">
<summary>
Allows for creating public threads.
</summary>
</member>
<member name="F:Discord.ChannelPermission.CreatePrivateThreads">
<summary>
Allows for creating private threads.
</summary>
</member>
<member name="F:Discord.ChannelPermission.UseExternalStickers">
<summary>
Allows the usage of custom stickers from other servers.
</summary>
</member>
<member name="F:Discord.ChannelPermission.SendMessagesInThreads">
<summary>
Allows for sending messages in threads.
</summary>
</member>
<member name="F:Discord.ChannelPermission.StartEmbeddedActivities">
<summary>
Allows for launching activities (applications with the EMBEDDED flag) in a voice channel.
</summary>
</member>
<member name="F:Discord.ChannelPermissions.None"> <member name="F:Discord.ChannelPermissions.None">
<summary> Gets a blank <see cref="T:Discord.ChannelPermissions"/> that grants no permissions. </summary>
<returns> A <see cref="T:Discord.ChannelPermissions"/> structure that does not contain any set permissions. </returns>
<summary> Gets a blank <see cref="T:Discord.ChannelPermissions"/> that grants no permissions.</summary>
<returns> A <see cref="T:Discord.ChannelPermissions"/> structure that does not contain any set permissions.</returns>
</member> </member>
<member name="F:Discord.ChannelPermissions.Text"> <member name="F:Discord.ChannelPermissions.Text">
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for text channels. </summary>
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for text channels.</summary>
</member> </member>
<member name="F:Discord.ChannelPermissions.Voice"> <member name="F:Discord.ChannelPermissions.Voice">
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for voice channels. </summary>
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for voice channels.</summary>
</member>
<member name="F:Discord.ChannelPermissions.Stage">
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for stage channels.</summary>
</member> </member>
<member name="F:Discord.ChannelPermissions.Category"> <member name="F:Discord.ChannelPermissions.Category">
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for category channels. </summary>
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for category channels.</summary>
</member> </member>
<member name="F:Discord.ChannelPermissions.DM"> <member name="F:Discord.ChannelPermissions.DM">
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for direct message channels. </summary>
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for direct message channels.</summary>
</member> </member>
<member name="F:Discord.ChannelPermissions.Group"> <member name="F:Discord.ChannelPermissions.Group">
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for group channels. </summary>
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for group channels.</summary>
</member> </member>
<member name="M:Discord.ChannelPermissions.All(Discord.IChannel)"> <member name="M:Discord.ChannelPermissions.All(Discord.IChannel)">
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for a given channel type. </summary>
<summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for a given channel type.</summary>
<exception cref="T:System.ArgumentException">Unknown channel type.</exception> <exception cref="T:System.ArgumentException">Unknown channel type.</exception>
</member> </member>
<member name="P:Discord.ChannelPermissions.RawValue"> <member name="P:Discord.ChannelPermissions.RawValue">
<summary> Gets a packed value representing all the permissions in this <see cref="T:Discord.ChannelPermissions"/>. </summary>
<summary> Gets a packed value representing all the permissions in this <see cref="T:Discord.ChannelPermissions"/>.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.CreateInstantInvite"> <member name="P:Discord.ChannelPermissions.CreateInstantInvite">
<summary> If <c>true</c>, a user may create invites. </summary>
<summary> If <c>true</c>, a user may create invites.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.ManageChannel"> <member name="P:Discord.ChannelPermissions.ManageChannel">
<summary> If <c>true</c>, a user may create, delete and modify this channel. </summary>
<summary> If <c>true</c>, a user may create, delete and modify this channel.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.AddReactions"> <member name="P:Discord.ChannelPermissions.AddReactions">
<summary> If <c>true</c>, a user may add reactions. </summary>
<summary> If <c>true</c>, a user may add reactions.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.ViewChannel"> <member name="P:Discord.ChannelPermissions.ViewChannel">
<summary> If <c>true</c>, a user may view channels. </summary>
<summary> If <c>true</c>, a user may view channels.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.SendMessages"> <member name="P:Discord.ChannelPermissions.SendMessages">
<summary> If <c>true</c>, a user may send messages. </summary>
<summary> If <c>true</c>, a user may send messages.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.SendTTSMessages"> <member name="P:Discord.ChannelPermissions.SendTTSMessages">
<summary> If <c>true</c>, a user may send text-to-speech messages. </summary>
<summary> If <c>true</c>, a user may send text-to-speech messages.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.ManageMessages"> <member name="P:Discord.ChannelPermissions.ManageMessages">
<summary> If <c>true</c>, a user may delete messages. </summary>
<summary> If <c>true</c>, a user may delete messages.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.EmbedLinks"> <member name="P:Discord.ChannelPermissions.EmbedLinks">
<summary> If <c>true</c>, Discord will auto-embed links sent by this user. </summary>
<summary> If <c>true</c>, Discord will auto-embed links sent by this user.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.AttachFiles"> <member name="P:Discord.ChannelPermissions.AttachFiles">
<summary> If <c>true</c>, a user may send files. </summary>
<summary> If <c>true</c>, a user may send files.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.ReadMessageHistory"> <member name="P:Discord.ChannelPermissions.ReadMessageHistory">
<summary> If <c>true</c>, a user may read previous messages. </summary>
<summary> If <c>true</c>, a user may read previous messages.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.MentionEveryone"> <member name="P:Discord.ChannelPermissions.MentionEveryone">
<summary> If <c>true</c>, a user may mention @everyone. </summary>
<summary> If <c>true</c>, a user may mention @everyone.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.UseExternalEmojis"> <member name="P:Discord.ChannelPermissions.UseExternalEmojis">
<summary> If <c>true</c>, a user may use custom emoji from other guilds. </summary>
<summary> If <c>true</c>, a user may use custom emoji from other guilds.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.Connect"> <member name="P:Discord.ChannelPermissions.Connect">
<summary> If <c>true</c>, a user may connect to a voice channel. </summary>
<summary> If <c>true</c>, a user may connect to a voice channel.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.Speak"> <member name="P:Discord.ChannelPermissions.Speak">
<summary> If <c>true</c>, a user may speak in a voice channel. </summary>
<summary> If <c>true</c>, a user may speak in a voice channel.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.MuteMembers"> <member name="P:Discord.ChannelPermissions.MuteMembers">
<summary> If <c>true</c>, a user may mute users. </summary>
<summary> If <c>true</c>, a user may mute users.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.DeafenMembers"> <member name="P:Discord.ChannelPermissions.DeafenMembers">
<summary> If <c>true</c>, a user may deafen users. </summary>
<summary> If <c>true</c>, a user may deafen users.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.MoveMembers"> <member name="P:Discord.ChannelPermissions.MoveMembers">
<summary> If <c>true</c>, a user may move other users between voice channels. </summary>
<summary> If <c>true</c>, a user may move other users between voice channels.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.UseVAD"> <member name="P:Discord.ChannelPermissions.UseVAD">
<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>
</member> </member>
<member name="P:Discord.ChannelPermissions.PrioritySpeaker"> <member name="P:Discord.ChannelPermissions.PrioritySpeaker">
<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>
</member> </member>
<member name="P:Discord.ChannelPermissions.Stream"> <member name="P:Discord.ChannelPermissions.Stream">
<summary> If <c>true</c>, a user may stream video in a voice channel. </summary>
<summary> If <c>true</c>, a user may stream video in a voice channel.</summary>
</member> </member>
<member name="P:Discord.ChannelPermissions.ManageRoles"> <member name="P:Discord.ChannelPermissions.ManageRoles">
<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>
</member> </member>
<member name="P:Discord.ChannelPermissions.ManageWebhooks"> <member name="P:Discord.ChannelPermissions.ManageWebhooks">
<summary> If <c>true</c>, a user may edit the webhooks for this channel. </summary>
<summary> If <c>true</c>, a user may edit the webhooks for this channel.</summary>
</member>
<member name="P:Discord.ChannelPermissions.UseApplicationCommands">
<summary> If <c>true</c>, a user may use application commands in this guild.</summary>
</member>
<member name="P:Discord.ChannelPermissions.RequestToSpeak">
<summary> If <c>true</c>, a user may request to speak in stage channels.</summary>
</member>
<member name="P:Discord.ChannelPermissions.ManageThreads">
<summary> If <c>true</c>, a user may manage threads in this guild.</summary>
</member>
<member name="P:Discord.ChannelPermissions.CreatePublicThreads">
<summary> If <c>true</c>, a user may create public threads in this guild.</summary>
</member>
<member name="P:Discord.ChannelPermissions.CreatePrivateThreads">
<summary> If <c>true</c>, a user may create private threads in this guild.</summary>
</member>
<member name="P:Discord.ChannelPermissions.UseExternalStickers">
<summary> If <c>true</c>, a user may use external stickers in this guild.</summary>
</member>
<member name="P:Discord.ChannelPermissions.SendMessagesInThreads">
<summary> If <c>true</c>, a user may send messages in threads in this guild.</summary>
</member>
<member name="P:Discord.ChannelPermissions.StartEmbeddedActivities">
<summary> If <c>true</c>, a user launch application activites in voice channels in this guild.</summary>
</member> </member>
<member name="M:Discord.ChannelPermissions.#ctor(System.UInt64)"> <member name="M:Discord.ChannelPermissions.#ctor(System.UInt64)">
<summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> with the provided packed value. </summary>
<summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> with the provided packed value.</summary>
</member> </member>
<member name="M:Discord.ChannelPermissions.#ctor(System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)">
<summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> with the provided permissions. </summary>
<member name="M:Discord.ChannelPermissions.#ctor(System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)">
<summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> with the provided permissions.</summary>
</member> </member>
<member name="M:Discord.ChannelPermissions.Modify(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> from this one, changing the provided non-null permissions. </summary>
<member name="M:Discord.ChannelPermissions.Modify(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> from this one, changing the provided non-null permissions.</summary>
</member> </member>
<member name="T:Discord.GuildApplicationCommandPermission"> <member name="T:Discord.GuildApplicationCommandPermission">
<summary> <summary>
@@ -8950,6 +9007,11 @@
Allows members to use slash commands in text channels. Allows members to use slash commands in text channels.
</summary> </summary>
</member> </member>
<member name="F:Discord.GuildPermission.UseApplicationCommands">
<summary>
Allows members to use application commands like slash commands and context menus in text channels.
</summary>
</member>
<member name="F:Discord.GuildPermission.RequestToSpeak"> <member name="F:Discord.GuildPermission.RequestToSpeak">
<summary> <summary>
Allows for requesting to speak in stage channels. <i>(This permission is under active development and may be changed or removed.)</i>. Allows for requesting to speak in stage channels. <i>(This permission is under active development and may be changed or removed.)</i>.
@@ -9104,7 +9166,7 @@
<member name="P:Discord.GuildPermissions.ManageEmojisAndStickers"> <member name="P:Discord.GuildPermissions.ManageEmojisAndStickers">
<summary> If <c>true</c>, a user may edit the emojis and stickers for this guild. </summary> <summary> If <c>true</c>, a user may edit the emojis and stickers for this guild. </summary>
</member> </member>
<member name="P:Discord.GuildPermissions.UseSlashCommands">
<member name="P:Discord.GuildPermissions.UseApplicationCommands">
<summary> If <c>true</c>, a user may use slash commands in this guild. </summary> <summary> If <c>true</c>, a user may use slash commands in this guild. </summary>
</member> </member>
<member name="P:Discord.GuildPermissions.RequestToSpeak"> <member name="P:Discord.GuildPermissions.RequestToSpeak">
@@ -9119,12 +9181,6 @@
<member name="P:Discord.GuildPermissions.CreatePrivateThreads"> <member name="P:Discord.GuildPermissions.CreatePrivateThreads">
<summary> If <c>true</c>, a user may create private threads in this guild. </summary> <summary> If <c>true</c>, a user may create private threads in this guild. </summary>
</member> </member>
<member name="P:Discord.GuildPermissions.UsePublicThreads">
<summary> If <c>true</c>, a user may use public threads in this guild. </summary>
</member>
<member name="P:Discord.GuildPermissions.UsePrivateThreads">
<summary> If <c>true</c>, a user may use private threads in this guild. </summary>
</member>
<member name="P:Discord.GuildPermissions.UseExternalStickers"> <member name="P:Discord.GuildPermissions.UseExternalStickers">
<summary> If <c>true</c>, a user may use external stickers in this guild. </summary> <summary> If <c>true</c>, a user may use external stickers in this guild. </summary>
</member> </member>
@@ -9140,10 +9196,10 @@
<member name="M:Discord.GuildPermissions.#ctor(System.String)"> <member name="M:Discord.GuildPermissions.#ctor(System.String)">
<summary> Creates a new <see cref="T:Discord.GuildPermissions"/> with the provided packed value after converting to ulong. </summary> <summary> Creates a new <see cref="T:Discord.GuildPermissions"/> with the provided packed value after converting to ulong. </summary>
</member> </member>
<member name="M:Discord.GuildPermissions.#ctor(System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)">
<member name="M:Discord.GuildPermissions.#ctor(System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)">
<summary> Creates a new <see cref="T:Discord.GuildPermissions"/> structure with the provided permissions. </summary> <summary> Creates a new <see cref="T:Discord.GuildPermissions"/> structure with the provided permissions. </summary>
</member> </member>
<member name="M:Discord.GuildPermissions.Modify(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<member name="M:Discord.GuildPermissions.Modify(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary> Creates a new <see cref="T:Discord.GuildPermissions"/> from this one, changing the provided non-null permissions. </summary> <summary> Creates a new <see cref="T:Discord.GuildPermissions"/> from this one, changing the provided non-null permissions. </summary>
</member> </member>
<member name="M:Discord.GuildPermissions.Has(Discord.GuildPermission)"> <member name="M:Discord.GuildPermissions.Has(Discord.GuildPermission)">
@@ -9284,18 +9340,42 @@
<member name="P:Discord.OverwritePermissions.ManageWebhooks"> <member name="P:Discord.OverwritePermissions.ManageWebhooks">
<summary> If True, a user may edit the webhooks for this channel. </summary> <summary> If True, a user may edit the webhooks for this channel. </summary>
</member> </member>
<member name="P:Discord.OverwritePermissions.UseApplicationCommands">
<summary> If <c>true</c>, a user may use slash commands in this guild. </summary>
</member>
<member name="P:Discord.OverwritePermissions.RequestToSpeak">
<summary> If <c>true</c>, a user may request to speak in stage channels. </summary>
</member>
<member name="P:Discord.OverwritePermissions.ManageThreads">
<summary> If <c>true</c>, a user may manage threads in this guild. </summary>
</member>
<member name="P:Discord.OverwritePermissions.CreatePublicThreads">
<summary> If <c>true</c>, a user may create public threads in this guild. </summary>
</member>
<member name="P:Discord.OverwritePermissions.CreatePrivateThreads">
<summary> If <c>true</c>, a user may create private threads in this guild. </summary>
</member>
<member name="P:Discord.OverwritePermissions.UseExternalStickers">
<summary> If <c>true</c>, a user may use external stickers in this guild. </summary>
</member>
<member name="P:Discord.OverwritePermissions.SendMessagesInThreads">
<summary> If <c>true</c>, a user may send messages in threads in this guild. </summary>
</member>
<member name="P:Discord.OverwritePermissions.StartEmbeddedActivities">
<summary> If <c>true</c>, a user launch application activites in voice channels in this guild. </summary>
</member>
<member name="M:Discord.OverwritePermissions.#ctor(System.UInt64,System.UInt64)"> <member name="M:Discord.OverwritePermissions.#ctor(System.UInt64,System.UInt64)">
<summary> Creates a new OverwritePermissions with the provided allow and deny packed values. </summary> <summary> Creates a new OverwritePermissions with the provided allow and deny packed values. </summary>
</member> </member>
<member name="M:Discord.OverwritePermissions.#ctor(System.String,System.String)"> <member name="M:Discord.OverwritePermissions.#ctor(System.String,System.String)">
<summary> Creates a new OverwritePermissions with the provided allow and deny packed values after converting to ulong. </summary> <summary> Creates a new OverwritePermissions with the provided allow and deny packed values after converting to ulong. </summary>
</member> </member>
<member name="M:Discord.OverwritePermissions.#ctor(Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue)">
<member name="M:Discord.OverwritePermissions.#ctor(Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue)">
<summary> <summary>
Initializes a new <see cref="T:Discord.ChannelPermissions"/> struct with the provided permissions. Initializes a new <see cref="T:Discord.ChannelPermissions"/> struct with the provided permissions.
</summary> </summary>
</member> </member>
<member name="M:Discord.OverwritePermissions.Modify(System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue})">
<member name="M:Discord.OverwritePermissions.Modify(System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue})">
<summary> <summary>
Initializes a new <see cref="T:Discord.OverwritePermissions" /> from the current one, changing the provided Initializes a new <see cref="T:Discord.OverwritePermissions" /> from the current one, changing the provided
non-null permissions. non-null permissions.


+ 30
- 2
src/Discord.Net.Core/Entities/Permissions/ChannelPermission.cs View File

@@ -113,12 +113,18 @@ namespace Discord
/// <summary> /// <summary>
/// Allows members to use slash commands in text channels. /// Allows members to use slash commands in text channels.
/// </summary> /// </summary>
[Obsolete("UseSlashCommands has been replaced by UseApplicationCommands", true)]
UseSlashCommands = 0x00_80_00_00_00, UseSlashCommands = 0x00_80_00_00_00,


/// <summary>
/// Allows members to use slash commands in text channels.
/// </summary>
UseApplicationCommands = 0x00_80_00_00_00,

/// <summary> /// <summary>
/// Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.) /// Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.)
/// </summary> /// </summary>
RequesToSpeak = 0x01_00_00_00_00,
RequestToSpeak = 0x01_00_00_00_00,


/// <summary> /// <summary>
/// Allows for deleting and archiving threads, and viewing all private threads /// Allows for deleting and archiving threads, and viewing all private threads
@@ -128,12 +134,34 @@ namespace Discord
/// <summary> /// <summary>
/// Allows for creating and participating in threads /// Allows for creating and participating in threads
/// </summary> /// </summary>
UsePublicThreads = 0x08_00_00_00_00,
[Obsolete("UsePublicThreads has been replaced by CreatePublicThreads and SendMessagesInThreads", true)]
UsePublicThreads = 0x08_00_00_00_00,


/// <summary> /// <summary>
/// Allows for creating and participating in private threads /// Allows for creating and participating in private threads
/// </summary> /// </summary>
[Obsolete("UsePrivateThreads has been replaced by CreatePrivateThreads and SendMessagesInThreads", true)]
UsePrivateThreads = 0x10_00_00_00_00, UsePrivateThreads = 0x10_00_00_00_00,
/// <summary>
/// Allows for creating public threads.
/// </summary>
CreatePublicThreads = 0x08_00_00_00_00,
/// <summary>
/// Allows for creating private threads.
/// </summary>
CreatePrivateThreads = 0x10_00_00_00_00,
/// <summary>
/// Allows the usage of custom stickers from other servers.
/// </summary>
UseExternalStickers = 0x20_00_00_00_00,
/// <summary>
/// Allows for sending messages in threads.
/// </summary>
SendMessagesInThreads = 0x40_00_00_00_00,
/// <summary>
/// Allows for launching activities (applications with the EMBEDDED flag) in a voice channel.
/// </summary>
StartEmbeddedActivities = 0x80_00_00_00_00


} }
} }

+ 102
- 41
src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs View File

@@ -7,26 +7,29 @@ namespace Discord
[DebuggerDisplay("{DebuggerDisplay,nq}")] [DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct ChannelPermissions public struct ChannelPermissions
{ {
/// <summary> Gets a blank <see cref="ChannelPermissions"/> that grants no permissions. </summary>
/// <returns> A <see cref="ChannelPermissions"/> structure that does not contain any set permissions. </returns>
/// <summary> Gets a blank <see cref="ChannelPermissions"/> that grants no permissions.</summary>
/// <returns> A <see cref="ChannelPermissions"/> structure that does not contain any set permissions.</returns>
public static readonly ChannelPermissions None = new ChannelPermissions(); public static readonly ChannelPermissions None = new ChannelPermissions();
/// <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);
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for voice channels. </summary>
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 text channels.</summary>
public static readonly ChannelPermissions Text = new ChannelPermissions(0b0_11111_0101100_0000000_1111111110001_010001);
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for voice channels.</summary>
public static readonly ChannelPermissions Voice = new ChannelPermissions(0b1_00000_0000100_1111110_0000000011100_010001);
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for stage channels.</summary>
public static readonly ChannelPermissions Stage = new ChannelPermissions(0b0_00000_1000100_0111010_0000000010000_010001);
/// <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>
public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110001_000000); public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110001_000000);
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for group channels. </summary>
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for group channels.</summary>
public static readonly ChannelPermissions Group = new ChannelPermissions(0b00000_1000110_0001101100000_000000); public static readonly ChannelPermissions Group = new ChannelPermissions(0b00000_1000110_0001101100000_000000);
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for a given channel type. </summary>
/// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for a given channel type.</summary>
/// <exception cref="ArgumentException">Unknown channel type.</exception> /// <exception cref="ArgumentException">Unknown channel type.</exception>
public static ChannelPermissions All(IChannel channel) public static ChannelPermissions All(IChannel channel)
{ {
return channel switch return channel switch
{ {
ITextChannel _ => Text, ITextChannel _ => Text,
IStageChannel _ => Stage,
IVoiceChannel _ => Voice, IVoiceChannel _ => Voice,
ICategoryChannel _ => Category, ICategoryChannel _ => Category,
IDMChannel _ => DM, IDMChannel _ => DM,
@@ -35,59 +38,75 @@ namespace Discord
}; };
} }


/// <summary> Gets a packed value representing all the permissions in this <see cref="ChannelPermissions"/>. </summary>
/// <summary> Gets a packed value representing all the permissions in this <see cref="ChannelPermissions"/>.</summary>
public ulong RawValue { get; } public ulong RawValue { get; }


/// <summary> If <c>true</c>, a user may create invites. </summary>
/// <summary> If <c>true</c>, a user may create invites.</summary>
public bool CreateInstantInvite => Permissions.GetValue(RawValue, ChannelPermission.CreateInstantInvite); public bool CreateInstantInvite => Permissions.GetValue(RawValue, ChannelPermission.CreateInstantInvite);
/// <summary> If <c>true</c>, a user may create, delete and modify this channel. </summary>
/// <summary> If <c>true</c>, a user may create, delete and modify this channel.</summary>
public bool ManageChannel => Permissions.GetValue(RawValue, ChannelPermission.ManageChannels); public bool ManageChannel => Permissions.GetValue(RawValue, ChannelPermission.ManageChannels);


/// <summary> If <c>true</c>, a user may add reactions. </summary>
/// <summary> If <c>true</c>, a user may add reactions.</summary>
public bool AddReactions => Permissions.GetValue(RawValue, ChannelPermission.AddReactions); public bool AddReactions => Permissions.GetValue(RawValue, ChannelPermission.AddReactions);
/// <summary> If <c>true</c>, a user may view channels. </summary>
/// <summary> If <c>true</c>, a user may view channels.</summary>
public bool ViewChannel => Permissions.GetValue(RawValue, ChannelPermission.ViewChannel); public bool ViewChannel => Permissions.GetValue(RawValue, ChannelPermission.ViewChannel);


/// <summary> If <c>true</c>, a user may send messages. </summary>
/// <summary> If <c>true</c>, a user may send messages.</summary>
public bool SendMessages => Permissions.GetValue(RawValue, ChannelPermission.SendMessages); public bool SendMessages => Permissions.GetValue(RawValue, ChannelPermission.SendMessages);
/// <summary> If <c>true</c>, a user may send text-to-speech messages. </summary>
/// <summary> If <c>true</c>, a user may send text-to-speech messages.</summary>
public bool SendTTSMessages => Permissions.GetValue(RawValue, ChannelPermission.SendTTSMessages); public bool SendTTSMessages => Permissions.GetValue(RawValue, ChannelPermission.SendTTSMessages);
/// <summary> If <c>true</c>, a user may delete messages. </summary>
/// <summary> If <c>true</c>, a user may delete messages.</summary>
public bool ManageMessages => Permissions.GetValue(RawValue, ChannelPermission.ManageMessages); public bool ManageMessages => Permissions.GetValue(RawValue, ChannelPermission.ManageMessages);
/// <summary> If <c>true</c>, Discord will auto-embed links sent by this user. </summary>
/// <summary> If <c>true</c>, Discord will auto-embed links sent by this user.</summary>
public bool EmbedLinks => Permissions.GetValue(RawValue, ChannelPermission.EmbedLinks); public bool EmbedLinks => Permissions.GetValue(RawValue, ChannelPermission.EmbedLinks);
/// <summary> If <c>true</c>, a user may send files. </summary>
/// <summary> If <c>true</c>, a user may send files.</summary>
public bool AttachFiles => Permissions.GetValue(RawValue, ChannelPermission.AttachFiles); public bool AttachFiles => Permissions.GetValue(RawValue, ChannelPermission.AttachFiles);
/// <summary> If <c>true</c>, a user may read previous messages. </summary>
/// <summary> If <c>true</c>, a user may read previous messages.</summary>
public bool ReadMessageHistory => Permissions.GetValue(RawValue, ChannelPermission.ReadMessageHistory); public bool ReadMessageHistory => Permissions.GetValue(RawValue, ChannelPermission.ReadMessageHistory);
/// <summary> If <c>true</c>, a user may mention @everyone. </summary>
/// <summary> If <c>true</c>, a user may mention @everyone.</summary>
public bool MentionEveryone => Permissions.GetValue(RawValue, ChannelPermission.MentionEveryone); public bool MentionEveryone => Permissions.GetValue(RawValue, ChannelPermission.MentionEveryone);
/// <summary> If <c>true</c>, a user may use custom emoji from other guilds. </summary>
/// <summary> If <c>true</c>, a user may use custom emoji from other guilds.</summary>
public bool UseExternalEmojis => Permissions.GetValue(RawValue, ChannelPermission.UseExternalEmojis); public bool UseExternalEmojis => Permissions.GetValue(RawValue, ChannelPermission.UseExternalEmojis);


/// <summary> If <c>true</c>, a user may connect to a voice channel. </summary>
/// <summary> If <c>true</c>, a user may connect to a voice channel.</summary>
public bool Connect => Permissions.GetValue(RawValue, ChannelPermission.Connect); public bool Connect => Permissions.GetValue(RawValue, ChannelPermission.Connect);
/// <summary> If <c>true</c>, a user may speak in a voice channel. </summary>
/// <summary> If <c>true</c>, a user may speak in a voice channel.</summary>
public bool Speak => Permissions.GetValue(RawValue, ChannelPermission.Speak); public bool Speak => Permissions.GetValue(RawValue, ChannelPermission.Speak);
/// <summary> If <c>true</c>, a user may mute users. </summary>
/// <summary> If <c>true</c>, a user may mute users.</summary>
public bool MuteMembers => Permissions.GetValue(RawValue, ChannelPermission.MuteMembers); public bool MuteMembers => Permissions.GetValue(RawValue, ChannelPermission.MuteMembers);
/// <summary> If <c>true</c>, a user may deafen users. </summary>
/// <summary> If <c>true</c>, a user may deafen users.</summary>
public bool DeafenMembers => Permissions.GetValue(RawValue, ChannelPermission.DeafenMembers); public bool DeafenMembers => Permissions.GetValue(RawValue, ChannelPermission.DeafenMembers);
/// <summary> If <c>true</c>, a user may move other users between voice channels. </summary>
/// <summary> If <c>true</c>, a user may move other users between voice channels.</summary>
public bool MoveMembers => Permissions.GetValue(RawValue, ChannelPermission.MoveMembers); public bool MoveMembers => Permissions.GetValue(RawValue, ChannelPermission.MoveMembers);
/// <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, 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>
/// <summary> If <c>true</c>, a user may stream video in a voice channel.</summary>
public bool Stream => Permissions.GetValue(RawValue, ChannelPermission.Stream); 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);
/// <summary> If <c>true</c>, a user may edit the webhooks for this channel. </summary>
/// <summary> If <c>true</c>, a user may edit the webhooks for this channel.</summary>
public bool ManageWebhooks => Permissions.GetValue(RawValue, ChannelPermission.ManageWebhooks); public bool ManageWebhooks => Permissions.GetValue(RawValue, ChannelPermission.ManageWebhooks);
/// <summary> If <c>true</c>, a user may use application commands in this guild.</summary>
public bool UseApplicationCommands => Permissions.GetValue(RawValue, ChannelPermission.UseApplicationCommands);
/// <summary> If <c>true</c>, a user may request to speak in stage channels.</summary>
public bool RequestToSpeak => Permissions.GetValue(RawValue, ChannelPermission.RequestToSpeak);
/// <summary> If <c>true</c>, a user may manage threads in this guild.</summary>
public bool ManageThreads => Permissions.GetValue(RawValue, ChannelPermission.ManageThreads);
/// <summary> If <c>true</c>, a user may create public threads in this guild.</summary>
public bool CreatePublicThreads => Permissions.GetValue(RawValue, ChannelPermission.CreatePublicThreads);
/// <summary> If <c>true</c>, a user may create private threads in this guild.</summary>
public bool CreatePrivateThreads => Permissions.GetValue(RawValue, ChannelPermission.CreatePrivateThreads);
/// <summary> If <c>true</c>, a user may use external stickers in this guild.</summary>
public bool UseExternalStickers => Permissions.GetValue(RawValue, ChannelPermission.UseExternalStickers);
/// <summary> If <c>true</c>, a user may send messages in threads in this guild.</summary>
public bool SendMessagesInThreads => Permissions.GetValue(RawValue, ChannelPermission.SendMessagesInThreads);
/// <summary> If <c>true</c>, a user launch application activites in voice channels in this guild.</summary>
public bool StartEmbeddedActivities => Permissions.GetValue(RawValue, ChannelPermission.StartEmbeddedActivities);


/// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided packed value. </summary>
/// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided packed value.</summary>
public ChannelPermissions(ulong rawValue) { RawValue = rawValue; } public ChannelPermissions(ulong rawValue) { RawValue = rawValue; }


private ChannelPermissions(ulong initialValue, private ChannelPermissions(ulong initialValue,
@@ -112,7 +131,15 @@ namespace Discord
bool? prioritySpeaker = null, bool? prioritySpeaker = null,
bool? stream = null, bool? stream = null,
bool? manageRoles = null, bool? manageRoles = null,
bool? manageWebhooks = null)
bool? manageWebhooks = null,
bool? useApplicationCommands = null,
bool? requestToSpeak = null,
bool? manageThreads = null,
bool? createPublicThreads = null,
bool? createPrivateThreads = null,
bool? useExternalStickers = null,
bool? sendMessagesInThreads = null,
bool? startEmbeddedActivities = null)
{ {
ulong value = initialValue; ulong value = initialValue;


@@ -138,11 +165,19 @@ namespace Discord
Permissions.SetValue(ref value, stream, ChannelPermission.Stream); 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);
Permissions.SetValue(ref value, useApplicationCommands, ChannelPermission.UseApplicationCommands);
Permissions.SetValue(ref value, requestToSpeak, ChannelPermission.RequestToSpeak);
Permissions.SetValue(ref value, manageThreads, ChannelPermission.ManageThreads);
Permissions.SetValue(ref value, createPublicThreads, ChannelPermission.CreatePublicThreads);
Permissions.SetValue(ref value, createPrivateThreads, ChannelPermission.CreatePrivateThreads);
Permissions.SetValue(ref value, useExternalStickers, ChannelPermission.UseExternalStickers);
Permissions.SetValue(ref value, sendMessagesInThreads, ChannelPermission.SendMessagesInThreads);
Permissions.SetValue(ref value, startEmbeddedActivities, ChannelPermission.StartEmbeddedActivities);


RawValue = value; RawValue = value;
} }


/// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided permissions. </summary>
/// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided permissions.</summary>
public ChannelPermissions( public ChannelPermissions(
bool createInstantInvite = false, bool createInstantInvite = false,
bool manageChannel = false, bool manageChannel = false,
@@ -165,13 +200,23 @@ namespace Discord
bool prioritySpeaker = false, bool prioritySpeaker = false,
bool stream = false, bool stream = false,
bool manageRoles = false, bool manageRoles = false,
bool manageWebhooks = false)
bool manageWebhooks = false,
bool useApplicationCommands = false,
bool requestToSpeak = false,
bool manageThreads = false,
bool createPublicThreads = false,
bool createPrivateThreads = false,
bool useExternalStickers = false,
bool sendMessagesInThreads = false,
bool startEmbeddedActivities = 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, stream, manageRoles, manageWebhooks)
speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, prioritySpeaker, stream, manageRoles, manageWebhooks,
useApplicationCommands, requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads,
startEmbeddedActivities)
{ } { }


/// <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>
public ChannelPermissions Modify( public ChannelPermissions Modify(
bool? createInstantInvite = null, bool? createInstantInvite = null,
bool? manageChannel = null, bool? manageChannel = null,
@@ -194,7 +239,15 @@ namespace Discord
bool? prioritySpeaker = null, bool? prioritySpeaker = null,
bool? stream = null, bool? stream = null,
bool? manageRoles = null, bool? manageRoles = null,
bool? manageWebhooks = null)
bool? manageWebhooks = null,
bool? useApplicationCommands = null,
bool? requestToSpeak = null,
bool? manageThreads = null,
bool? createPublicThreads = null,
bool? createPrivateThreads = null,
bool? useExternalStickers = null,
bool? sendMessagesInThreads = null,
bool? startEmbeddedActivities = null)
=> new ChannelPermissions(RawValue, => new ChannelPermissions(RawValue,
createInstantInvite, createInstantInvite,
manageChannel, manageChannel,
@@ -217,7 +270,15 @@ namespace Discord
prioritySpeaker, prioritySpeaker,
stream, stream,
manageRoles, manageRoles,
manageWebhooks);
manageWebhooks,
useApplicationCommands,
requestToSpeak,
manageThreads,
createPublicThreads,
createPrivateThreads,
useExternalStickers,
sendMessagesInThreads,
startEmbeddedActivities);


public bool Has(ChannelPermission permission) => Permissions.GetValue(RawValue, permission); public bool Has(ChannelPermission permission) => Permissions.GetValue(RawValue, permission);




+ 7
- 2
src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs View File

@@ -178,8 +178,13 @@ namespace Discord
/// <summary> /// <summary>
/// Allows members to use slash commands in text channels. /// Allows members to use slash commands in text channels.
/// </summary> /// </summary>
[Obsolete("UseSlashCommands has been replaced by UseApplicationCommands", true)]
UseSlashCommands = 0x80_00_00_00, UseSlashCommands = 0x80_00_00_00,
/// <summary> /// <summary>
/// Allows members to use application commands like slash commands and context menus in text channels.
/// </summary>
UseApplicationCommands = 0x80_00_00_00,
/// <summary>
/// Allows for requesting to speak in stage channels. <i>(This permission is under active development and may be changed or removed.)</i>. /// Allows for requesting to speak in stage channels. <i>(This permission is under active development and may be changed or removed.)</i>.
/// </summary> /// </summary>
RequestToSpeak = 0x01_00_00_00_00, RequestToSpeak = 0x01_00_00_00_00,
@@ -202,12 +207,12 @@ namespace Discord
/// <summary> /// <summary>
/// Allows for creating public threads. /// Allows for creating public threads.
/// </summary> /// </summary>
[Obsolete("UsePublicThreads has been replaced by CreatePublicThreads and SendMessagesInThreads")]
[Obsolete("UsePublicThreads has been replaced by CreatePublicThreads and SendMessagesInThreads", true)]
UsePublicThreads = 0x08_00_00_00_00, UsePublicThreads = 0x08_00_00_00_00,
/// <summary> /// <summary>
/// Allows for creating private threads. /// Allows for creating private threads.
/// </summary> /// </summary>
[Obsolete("UsePrivateThreads has been replaced by CreatePrivateThreads and SendMessagesInThreads")]
[Obsolete("UsePrivateThreads has been replaced by CreatePrivateThreads and SendMessagesInThreads", true)]
UsePrivateThreads = 0x10_00_00_00_00, UsePrivateThreads = 0x10_00_00_00_00,
/// <summary> /// <summary>
/// Allows the usage of custom stickers from other servers. /// Allows the usage of custom stickers from other servers.


+ 9
- 23
src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs View File

@@ -10,9 +10,9 @@ namespace Discord
/// <summary> Gets a blank <see cref="GuildPermissions"/> that grants no permissions. </summary> /// <summary> Gets a blank <see cref="GuildPermissions"/> that grants no permissions. </summary>
public static readonly GuildPermissions None = new GuildPermissions(); public static readonly GuildPermissions None = new GuildPermissions();
/// <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(0b0_00000_0000000_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(0b1111111111_11111_1111111_1111111111111_11111);
public static readonly GuildPermissions All = new GuildPermissions(0b1_11111_1111111_1111111_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; }
@@ -84,7 +84,7 @@ namespace Discord
/// <summary> If <c>true</c>, a user may edit the emojis and stickers for this guild. </summary> /// <summary> If <c>true</c>, a user may edit the emojis and stickers for this guild. </summary>
public bool ManageEmojisAndStickers => Permissions.GetValue(RawValue, GuildPermission.ManageEmojisAndStickers); public bool ManageEmojisAndStickers => Permissions.GetValue(RawValue, GuildPermission.ManageEmojisAndStickers);
/// <summary> If <c>true</c>, a user may use slash commands in this guild. </summary> /// <summary> If <c>true</c>, a user may use slash commands in this guild. </summary>
public bool UseSlashCommands => Permissions.GetValue(RawValue, GuildPermission.UseSlashCommands);
public bool UseApplicationCommands => Permissions.GetValue(RawValue, GuildPermission.UseApplicationCommands);
/// <summary> If <c>true</c>, a user may request to speak in stage channels. </summary> /// <summary> If <c>true</c>, a user may request to speak in stage channels. </summary>
public bool RequestToSpeak => Permissions.GetValue(RawValue, GuildPermission.RequestToSpeak); public bool RequestToSpeak => Permissions.GetValue(RawValue, GuildPermission.RequestToSpeak);
/// <summary> If <c>true</c>, a user may manage threads in this guild. </summary> /// <summary> If <c>true</c>, a user may manage threads in this guild. </summary>
@@ -93,10 +93,6 @@ namespace Discord
public bool CreatePublicThreads => Permissions.GetValue(RawValue, GuildPermission.CreatePublicThreads); public bool CreatePublicThreads => Permissions.GetValue(RawValue, GuildPermission.CreatePublicThreads);
/// <summary> If <c>true</c>, a user may create private threads in this guild. </summary> /// <summary> If <c>true</c>, a user may create private threads in this guild. </summary>
public bool CreatePrivateThreads => Permissions.GetValue(RawValue, GuildPermission.CreatePrivateThreads); public bool CreatePrivateThreads => Permissions.GetValue(RawValue, GuildPermission.CreatePrivateThreads);
/// <summary> If <c>true</c>, a user may use public threads in this guild. </summary>
public bool UsePublicThreads => Permissions.GetValue(RawValue, GuildPermission.UsePublicThreads);
/// <summary> If <c>true</c>, a user may use private threads in this guild. </summary>
public bool UsePrivateThreads => Permissions.GetValue(RawValue, GuildPermission.UsePrivateThreads);
/// <summary> If <c>true</c>, a user may use external stickers in this guild. </summary> /// <summary> If <c>true</c>, a user may use external stickers in this guild. </summary>
public bool UseExternalStickers => Permissions.GetValue(RawValue, GuildPermission.UseExternalStickers); public bool UseExternalStickers => Permissions.GetValue(RawValue, GuildPermission.UseExternalStickers);
/// <summary> If <c>true</c>, a user may send messages in threads in this guild. </summary> /// <summary> If <c>true</c>, a user may send messages in threads in this guild. </summary>
@@ -142,13 +138,11 @@ namespace Discord
bool? manageRoles = null, bool? manageRoles = null,
bool? manageWebhooks = null, bool? manageWebhooks = null,
bool? manageEmojisAndStickers = null, bool? manageEmojisAndStickers = null,
bool? useSlashCommands = null,
bool? useApplicationCommands = null,
bool? requestToSpeak = null, bool? requestToSpeak = null,
bool? manageThreads = null, bool? manageThreads = null,
bool? createPublicThreads = null, bool? createPublicThreads = null,
bool? createPrivateThreads = null, bool? createPrivateThreads = null,
bool? usePublicThreads = null,
bool? usePrivateThreads = null,
bool? useExternalStickers = null, bool? useExternalStickers = null,
bool? sendMessagesInThreads = null, bool? sendMessagesInThreads = null,
bool? startEmbeddedActivities = null) bool? startEmbeddedActivities = null)
@@ -186,13 +180,11 @@ namespace Discord
Permissions.SetValue(ref value, manageRoles, GuildPermission.ManageRoles); Permissions.SetValue(ref value, manageRoles, GuildPermission.ManageRoles);
Permissions.SetValue(ref value, manageWebhooks, GuildPermission.ManageWebhooks); Permissions.SetValue(ref value, manageWebhooks, GuildPermission.ManageWebhooks);
Permissions.SetValue(ref value, manageEmojisAndStickers, GuildPermission.ManageEmojisAndStickers); Permissions.SetValue(ref value, manageEmojisAndStickers, GuildPermission.ManageEmojisAndStickers);
Permissions.SetValue(ref value, useSlashCommands, GuildPermission.UseSlashCommands);
Permissions.SetValue(ref value, useApplicationCommands, GuildPermission.UseApplicationCommands);
Permissions.SetValue(ref value, requestToSpeak, GuildPermission.RequestToSpeak); Permissions.SetValue(ref value, requestToSpeak, GuildPermission.RequestToSpeak);
Permissions.SetValue(ref value, manageThreads, GuildPermission.ManageThreads); Permissions.SetValue(ref value, manageThreads, GuildPermission.ManageThreads);
Permissions.SetValue(ref value, createPublicThreads, GuildPermission.CreatePublicThreads); Permissions.SetValue(ref value, createPublicThreads, GuildPermission.CreatePublicThreads);
Permissions.SetValue(ref value, createPrivateThreads, GuildPermission.CreatePrivateThreads); Permissions.SetValue(ref value, createPrivateThreads, GuildPermission.CreatePrivateThreads);
Permissions.SetValue(ref value, usePublicThreads, GuildPermission.UsePublicThreads);
Permissions.SetValue(ref value, usePrivateThreads, GuildPermission.UsePrivateThreads);
Permissions.SetValue(ref value, useExternalStickers, GuildPermission.UseExternalStickers); Permissions.SetValue(ref value, useExternalStickers, GuildPermission.UseExternalStickers);
Permissions.SetValue(ref value, sendMessagesInThreads, GuildPermission.SendMessagesInThreads); Permissions.SetValue(ref value, sendMessagesInThreads, GuildPermission.SendMessagesInThreads);
Permissions.SetValue(ref value, startEmbeddedActivities, GuildPermission.StartEmbeddedActivities); Permissions.SetValue(ref value, startEmbeddedActivities, GuildPermission.StartEmbeddedActivities);
@@ -233,13 +225,11 @@ namespace Discord
bool manageRoles = false, bool manageRoles = false,
bool manageWebhooks = false, bool manageWebhooks = false,
bool manageEmojisAndStickers = false, bool manageEmojisAndStickers = false,
bool useSlashCommands = false,
bool useApplicationCommands = false,
bool requestToSpeak = false, bool requestToSpeak = false,
bool manageThreads = false, bool manageThreads = false,
bool createPublicThreads = false, bool createPublicThreads = false,
bool createPrivateThreads = false, bool createPrivateThreads = false,
bool usePublicThreads = false,
bool usePrivateThreads = false,
bool useExternalStickers = false, bool useExternalStickers = false,
bool sendMessagesInThreads = false, bool sendMessagesInThreads = false,
bool startEmbeddedActivities = false) bool startEmbeddedActivities = false)
@@ -275,13 +265,11 @@ namespace Discord
manageNicknames: manageNicknames, manageNicknames: manageNicknames,
manageWebhooks: manageWebhooks, manageWebhooks: manageWebhooks,
manageEmojisAndStickers: manageEmojisAndStickers, manageEmojisAndStickers: manageEmojisAndStickers,
useSlashCommands: useSlashCommands,
useApplicationCommands: useApplicationCommands,
requestToSpeak: requestToSpeak, requestToSpeak: requestToSpeak,
manageThreads: manageThreads, manageThreads: manageThreads,
createPublicThreads: createPublicThreads, createPublicThreads: createPublicThreads,
createPrivateThreads: createPrivateThreads, createPrivateThreads: createPrivateThreads,
usePublicThreads: usePublicThreads,
usePrivateThreads: usePrivateThreads,
useExternalStickers: useExternalStickers, useExternalStickers: useExternalStickers,
sendMessagesInThreads: sendMessagesInThreads, sendMessagesInThreads: sendMessagesInThreads,
startEmbeddedActivities: startEmbeddedActivities) startEmbeddedActivities: startEmbeddedActivities)
@@ -320,13 +308,11 @@ namespace Discord
bool? manageRoles = null, bool? manageRoles = null,
bool? manageWebhooks = null, bool? manageWebhooks = null,
bool? manageEmojisAndStickers = null, bool? manageEmojisAndStickers = null,
bool? useSlashCommands = null,
bool? useApplicationCommands = null,
bool? requestToSpeak = null, bool? requestToSpeak = null,
bool? manageThreads = null, bool? manageThreads = null,
bool? createPublicThreads = null, bool? createPublicThreads = null,
bool? createPrivateThreads = null, bool? createPrivateThreads = null,
bool? usePublicThreads = null,
bool? usePrivateThreads = null,
bool? useExternalStickers = null, bool? useExternalStickers = null,
bool? sendMessagesInThreads = null, bool? sendMessagesInThreads = null,
bool? startEmbeddedActivities = null) bool? startEmbeddedActivities = null)
@@ -334,7 +320,7 @@ namespace Discord
viewAuditLog, viewGuildInsights, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles, viewAuditLog, viewGuildInsights, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles,
readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers,
useVoiceActivation, prioritySpeaker, stream, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojisAndStickers, useVoiceActivation, prioritySpeaker, stream, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojisAndStickers,
useSlashCommands, requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, usePublicThreads, usePrivateThreads, useExternalStickers, sendMessagesInThreads,
useApplicationCommands, requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads,
startEmbeddedActivities); startEmbeddedActivities);


/// <summary> /// <summary>


+ 67
- 5
src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs View File

@@ -1,3 +1,4 @@
using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@@ -82,6 +83,22 @@ namespace Discord
public PermValue ManageRoles => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageRoles); public PermValue ManageRoles => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageRoles);
/// <summary> If True, a user may edit the webhooks for this channel. </summary> /// <summary> If True, a user may edit the webhooks for this channel. </summary>
public PermValue ManageWebhooks => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageWebhooks); public PermValue ManageWebhooks => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageWebhooks);
/// <summary> If <c>true</c>, a user may use slash commands in this guild. </summary>
public PermValue UseApplicationCommands => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseApplicationCommands);
/// <summary> If <c>true</c>, a user may request to speak in stage channels. </summary>
public PermValue RequestToSpeak => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.RequestToSpeak);
/// <summary> If <c>true</c>, a user may manage threads in this guild. </summary>
public PermValue ManageThreads => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageThreads);
/// <summary> If <c>true</c>, a user may create public threads in this guild. </summary>
public PermValue CreatePublicThreads => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.CreatePublicThreads);
/// <summary> If <c>true</c>, a user may create private threads in this guild. </summary>
public PermValue CreatePrivateThreads => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.CreatePrivateThreads);
/// <summary> If <c>true</c>, a user may use external stickers in this guild. </summary>
public PermValue UseExternalStickers => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseExternalStickers);
/// <summary> If <c>true</c>, a user may send messages in threads in this guild. </summary>
public PermValue SendMessagesInThreads => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.SendMessagesInThreads);
/// <summary> If <c>true</c>, a user launch application activites in voice channels in this guild. </summary>
public PermValue StartEmbeddedActivities => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.StartEmbeddedActivities);


/// <summary> Creates a new OverwritePermissions with the provided allow and deny packed values. </summary> /// <summary> Creates a new OverwritePermissions with the provided allow and deny packed values. </summary>
public OverwritePermissions(ulong allowValue, ulong denyValue) public OverwritePermissions(ulong allowValue, ulong denyValue)
@@ -119,7 +136,18 @@ namespace Discord
PermValue? manageRoles = null, PermValue? manageRoles = null,
PermValue? manageWebhooks = null, PermValue? manageWebhooks = null,
PermValue? prioritySpeaker = null, PermValue? prioritySpeaker = null,
PermValue? stream = null)
PermValue? stream = null,
PermValue? useSlashCommands = null,
PermValue? useApplicationCommands = null,
PermValue? requestToSpeak = null,
PermValue? manageThreads = null,
PermValue? createPublicThreads = null,
PermValue? createPrivateThreads = null,
PermValue? usePublicThreads = null,
PermValue? usePrivateThreads = null,
PermValue? useExternalStickers = null,
PermValue? sendMessagesInThreads = null,
PermValue? startEmbeddedActivities = null)
{ {
Permissions.SetValue(ref allowValue, ref denyValue, createInstantInvite, ChannelPermission.CreateInstantInvite); Permissions.SetValue(ref allowValue, ref denyValue, createInstantInvite, ChannelPermission.CreateInstantInvite);
Permissions.SetValue(ref allowValue, ref denyValue, manageChannel, ChannelPermission.ManageChannels); Permissions.SetValue(ref allowValue, ref denyValue, manageChannel, ChannelPermission.ManageChannels);
@@ -143,6 +171,14 @@ namespace Discord
Permissions.SetValue(ref allowValue, ref denyValue, stream, ChannelPermission.Stream); Permissions.SetValue(ref allowValue, ref denyValue, stream, ChannelPermission.Stream);
Permissions.SetValue(ref allowValue, ref denyValue, manageRoles, ChannelPermission.ManageRoles); Permissions.SetValue(ref allowValue, ref denyValue, manageRoles, ChannelPermission.ManageRoles);
Permissions.SetValue(ref allowValue, ref denyValue, manageWebhooks, ChannelPermission.ManageWebhooks); Permissions.SetValue(ref allowValue, ref denyValue, manageWebhooks, ChannelPermission.ManageWebhooks);
Permissions.SetValue(ref allowValue, ref denyValue, useApplicationCommands, ChannelPermission.UseApplicationCommands);
Permissions.SetValue(ref allowValue, ref denyValue, requestToSpeak, ChannelPermission.RequestToSpeak);
Permissions.SetValue(ref allowValue, ref denyValue, manageThreads, ChannelPermission.ManageThreads);
Permissions.SetValue(ref allowValue, ref denyValue, createPublicThreads, ChannelPermission.CreatePublicThreads);
Permissions.SetValue(ref allowValue, ref denyValue, createPrivateThreads, ChannelPermission.CreatePrivateThreads);
Permissions.SetValue(ref allowValue, ref denyValue, useExternalStickers, ChannelPermission.UseExternalStickers);
Permissions.SetValue(ref allowValue, ref denyValue, sendMessagesInThreads, ChannelPermission.SendMessagesInThreads);
Permissions.SetValue(ref allowValue, ref denyValue, startEmbeddedActivities, ChannelPermission.StartEmbeddedActivities);


AllowValue = allowValue; AllowValue = allowValue;
DenyValue = denyValue; DenyValue = denyValue;
@@ -173,10 +209,23 @@ namespace Discord
PermValue manageRoles = PermValue.Inherit, PermValue manageRoles = PermValue.Inherit,
PermValue manageWebhooks = PermValue.Inherit, PermValue manageWebhooks = PermValue.Inherit,
PermValue prioritySpeaker = PermValue.Inherit, PermValue prioritySpeaker = PermValue.Inherit,
PermValue stream = PermValue.Inherit)
PermValue stream = PermValue.Inherit,
PermValue useSlashCommands = PermValue.Inherit,
PermValue useApplicationCommands = PermValue.Inherit,
PermValue requestToSpeak = PermValue.Inherit,
PermValue manageThreads = PermValue.Inherit,
PermValue createPublicThreads = PermValue.Inherit,
PermValue createPrivateThreads = PermValue.Inherit,
PermValue usePublicThreads = PermValue.Inherit,
PermValue usePrivateThreads = PermValue.Inherit,
PermValue useExternalStickers = PermValue.Inherit,
PermValue sendMessagesInThreads = PermValue.Inherit,
PermValue startEmbeddedActivities = PermValue.Inherit)
: this(0, 0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages, : this(0, 0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages,
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers,
moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream) { }
moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream, useSlashCommands, useApplicationCommands,
requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, usePublicThreads, usePrivateThreads, useExternalStickers,
sendMessagesInThreads, startEmbeddedActivities) { }


/// <summary> /// <summary>
/// Initializes a new <see cref="OverwritePermissions" /> from the current one, changing the provided /// Initializes a new <see cref="OverwritePermissions" /> from the current one, changing the provided
@@ -204,10 +253,23 @@ namespace Discord
PermValue? manageRoles = null, PermValue? manageRoles = null,
PermValue? manageWebhooks = null, PermValue? manageWebhooks = null,
PermValue? prioritySpeaker = null, PermValue? prioritySpeaker = null,
PermValue? stream = null)
PermValue? stream = null,
PermValue? useSlashCommands = null,
PermValue? useApplicationCommands = null,
PermValue? requestToSpeak = null,
PermValue? manageThreads = null,
PermValue? createPublicThreads = null,
PermValue? createPrivateThreads = null,
PermValue? usePublicThreads = null,
PermValue? usePrivateThreads = null,
PermValue? useExternalStickers = null,
PermValue? sendMessagesInThreads = null,
PermValue? startEmbeddedActivities = null)
=> new OverwritePermissions(AllowValue, DenyValue, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages, => new OverwritePermissions(AllowValue, DenyValue, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages,
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers,
moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream);
moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream, useSlashCommands, useApplicationCommands,
requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, usePublicThreads, usePrivateThreads, useExternalStickers,
sendMessagesInThreads, startEmbeddedActivities);


/// <summary> /// <summary>
/// Creates a <see cref="List{T}"/> of all the <see cref="ChannelPermission"/> values that are allowed. /// Creates a <see cref="List{T}"/> of all the <see cref="ChannelPermission"/> values that are allowed.


+ 0
- 1
src/Discord.Net.Rest/Discord.Net.Rest.xml View File

@@ -3243,7 +3243,6 @@
<summary> <summary>
Gets a collection of all stage channels in this guild. Gets a collection of all stage channels in this guild.
</summary> </summary>
<param name="mode">The <see cref="T:Discord.CacheMode"/> that determines whether the object should be fetched from cache.</param>
<param name="options">The options to be used when sending the request.</param> <param name="options">The options to be used when sending the request.</param>
<returns> <returns>
A task that represents the asynchronous get operation. The task result contains a read-only collection of A task that represents the asynchronous get operation. The task result contains a read-only collection of


+ 0
- 4
src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml View File

@@ -4286,10 +4286,6 @@
<member name="M:Discord.WebSocket.SocketInteraction.RespondAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)"> <member name="M:Discord.WebSocket.SocketInteraction.RespondAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)">
<summary> <summary>
Responds to an Interaction with type <see cref="F:Discord.InteractionResponseType.ChannelMessageWithSource"/>. Responds to an Interaction with type <see cref="F:Discord.InteractionResponseType.ChannelMessageWithSource"/>.
<para>
If you have <see cref="!:DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use
<see cref="M:Discord.WebSocket.SocketInteraction.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)"/> instead.
</para>
</summary> </summary>
<param name="text">The text of the message to be sent.</param> <param name="text">The text of the message to be sent.</param>
<param name="embeds">A array of embeds to send with this response. Max 10.</param> <param name="embeds">A array of embeds to send with this response. Max 10.</param>


+ 4
- 0
test/Discord.Net.Tests.Unit/ChannelPermissionsTests.cs View File

@@ -85,6 +85,10 @@ namespace Discord
AssertFlag(() => new ChannelPermissions(stream: true), ChannelPermission.Stream); 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);
AssertFlag(() => new ChannelPermissions(useApplicationCommands: true), ChannelPermission.UseApplicationCommands);
AssertFlag(() => new ChannelPermissions(createPrivateThreads: true), ChannelPermission.CreatePrivateThreads);
AssertFlag(() => new ChannelPermissions(createPublicThreads: true), ChannelPermission.CreatePublicThreads);
AssertFlag(() => new ChannelPermissions(sendMessagesInThreads: true), ChannelPermission.SendMessagesInThreads);
} }


/// <summary> /// <summary>


+ 1
- 1
test/Discord.Net.Tests.Unit/ColorTests.cs View File

@@ -15,7 +15,7 @@ namespace Discord
{ {
Assert.Equal(0u, new Color().RawValue); Assert.Equal(0u, new Color().RawValue);
Assert.Equal(uint.MinValue, new Color(uint.MinValue).RawValue); Assert.Equal(uint.MinValue, new Color(uint.MinValue).RawValue);
Assert.Equal(uint.MaxValue, new Color(uint.MaxValue).RawValue);
Assert.Throws<ArgumentException>(() => new Color(uint.MaxValue));
} }
[Fact] [Fact]
public void Color_Default() public void Color_Default()


+ 2
- 2
test/Discord.Net.Tests.Unit/GuildPermissionsTests.cs View File

@@ -92,7 +92,7 @@ namespace Discord
AssertFlag(() => new GuildPermissions(manageRoles: true), GuildPermission.ManageRoles); AssertFlag(() => new GuildPermissions(manageRoles: true), GuildPermission.ManageRoles);
AssertFlag(() => new GuildPermissions(manageWebhooks: true), GuildPermission.ManageWebhooks); AssertFlag(() => new GuildPermissions(manageWebhooks: true), GuildPermission.ManageWebhooks);
AssertFlag(() => new GuildPermissions(manageEmojisAndStickers: true), GuildPermission.ManageEmojisAndStickers); AssertFlag(() => new GuildPermissions(manageEmojisAndStickers: true), GuildPermission.ManageEmojisAndStickers);
AssertFlag(() => new GuildPermissions(useSlashCommands: true), GuildPermission.UseSlashCommands);
AssertFlag(() => new GuildPermissions(useApplicationCommands: true), GuildPermission.UseApplicationCommands);
AssertFlag(() => new GuildPermissions(requestToSpeak: true), GuildPermission.RequestToSpeak); AssertFlag(() => new GuildPermissions(requestToSpeak: true), GuildPermission.RequestToSpeak);
AssertFlag(() => new GuildPermissions(manageThreads: true), GuildPermission.ManageThreads); AssertFlag(() => new GuildPermissions(manageThreads: true), GuildPermission.ManageThreads);
AssertFlag(() => new GuildPermissions(createPublicThreads: true), GuildPermission.CreatePublicThreads); AssertFlag(() => new GuildPermissions(createPublicThreads: true), GuildPermission.CreatePublicThreads);
@@ -168,7 +168,7 @@ namespace Discord
AssertUtil(GuildPermission.ManageRoles, x => x.ManageRoles, (p, enable) => p.Modify(manageRoles: enable)); AssertUtil(GuildPermission.ManageRoles, x => x.ManageRoles, (p, enable) => p.Modify(manageRoles: enable));
AssertUtil(GuildPermission.ManageWebhooks, x => x.ManageWebhooks, (p, enable) => p.Modify(manageWebhooks: enable)); AssertUtil(GuildPermission.ManageWebhooks, x => x.ManageWebhooks, (p, enable) => p.Modify(manageWebhooks: enable));
AssertUtil(GuildPermission.ManageEmojisAndStickers, x => x.ManageEmojisAndStickers, (p, enable) => p.Modify(manageEmojisAndStickers: enable)); AssertUtil(GuildPermission.ManageEmojisAndStickers, x => x.ManageEmojisAndStickers, (p, enable) => p.Modify(manageEmojisAndStickers: enable));
AssertUtil(GuildPermission.UseSlashCommands, x => x.UseSlashCommands, (p, enable) => p.Modify(useSlashCommands: enable));
AssertUtil(GuildPermission.UseApplicationCommands, x => x.UseApplicationCommands, (p, enable) => p.Modify(useApplicationCommands: enable));
AssertUtil(GuildPermission.RequestToSpeak, x => x.RequestToSpeak, (p, enable) => p.Modify(requestToSpeak: enable)); AssertUtil(GuildPermission.RequestToSpeak, x => x.RequestToSpeak, (p, enable) => p.Modify(requestToSpeak: enable));
AssertUtil(GuildPermission.ManageThreads, x => x.ManageThreads, (p, enable) => p.Modify(manageThreads: enable)); AssertUtil(GuildPermission.ManageThreads, x => x.ManageThreads, (p, enable) => p.Modify(manageThreads: enable));
AssertUtil(GuildPermission.CreatePublicThreads, x => x.CreatePublicThreads, (p, enable) => p.Modify(createPublicThreads: enable)); AssertUtil(GuildPermission.CreatePublicThreads, x => x.CreatePublicThreads, (p, enable) => p.Modify(createPublicThreads: enable));


Loading…
Cancel
Save