Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add missing overwrite perms #3037

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 55 additions & 5 deletions src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ public static OverwritePermissions DenyAll(IChannel channel)
public PermValue SendMessagesInThreads => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.SendMessagesInThreads);
/// <summary> If <see langword="true" />, a user launch application activities in voice channels in this guild. </summary>
public PermValue StartEmbeddedActivities => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.StartEmbeddedActivities);
/// <summary> If <see langword="true"/>, a user can use soundboard in a voice channel.</summary>
public PermValue UseSoundboard => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseSoundboard);
/// <summary> If <see langword="true"/>, a user can edit and cancel events in this channel.</summary>
public PermValue CreateEvents => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.CreateEvents);
/// <summary> If <see langword="true"/>, a user can send voice messages in this channel.</summary>
public PermValue SendVoiceMessages => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.SendVoiceMessages);
/// <summary> If <see langword="true"/>, a user can use the Clyde AI bot in this channel.</summary>
public PermValue UseClydeAI => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseClydeAI);
/// <summary> If <see langword="true"/>, a user can set the status of a voice channel.</summary>
public PermValue SetVoiceChannelStatus => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.SetVoiceChannelStatus);
/// <summary> If <see langword="true"/>, a user can send polls.</summary>
public PermValue SendPolls => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.SendPolls);
/// <summary> If <see langword="true"/>, a user-installed application can send public responses.</summary>
public PermValue UserExternalApps => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseExternalApps);
/// <summary> If <see langword="true"/>, a user-installed application can send public responses.</summary>
public PermValue UseExternalSounds => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseExternalSounds);

/// <summary> Creates a new OverwritePermissions with the provided allow and deny packed values. </summary>
public OverwritePermissions(ulong allowValue, ulong denyValue)
Expand Down Expand Up @@ -147,7 +163,15 @@ private OverwritePermissions(ulong allowValue, ulong denyValue,
PermValue? usePrivateThreads = null,
PermValue? useExternalStickers = null,
PermValue? sendMessagesInThreads = null,
PermValue? startEmbeddedActivities = null)
PermValue? startEmbeddedActivities = null,
PermValue? useSoundboard = null,
PermValue? createEvents = null,
PermValue? sendVoiceMessages = null,
PermValue? useClydeAI = null,
PermValue? setVoiceChannelStatus = null,
PermValue? sendPolls = null,
PermValue? useExternalApps = null,
PermValue? useExternalSounds = null)
{
Permissions.SetValue(ref allowValue, ref denyValue, createInstantInvite, ChannelPermission.CreateInstantInvite);
Permissions.SetValue(ref allowValue, ref denyValue, manageChannel, ChannelPermission.ManageChannels);
Expand Down Expand Up @@ -179,6 +203,14 @@ private OverwritePermissions(ulong allowValue, ulong denyValue,
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);
Permissions.SetValue(ref allowValue, ref denyValue, useSoundboard, ChannelPermission.UseSoundboard);
Permissions.SetValue(ref allowValue, ref denyValue, createEvents, ChannelPermission.CreateEvents);
Permissions.SetValue(ref allowValue, ref denyValue, sendVoiceMessages, ChannelPermission.SendVoiceMessages);
Permissions.SetValue(ref allowValue, ref denyValue, useClydeAI, ChannelPermission.UseClydeAI);
Permissions.SetValue(ref allowValue, ref denyValue, setVoiceChannelStatus, ChannelPermission.SetVoiceChannelStatus);
Permissions.SetValue(ref allowValue, ref denyValue, sendPolls, ChannelPermission.SendPolls);
Permissions.SetValue(ref allowValue, ref denyValue, useExternalApps, ChannelPermission.UseExternalApps);
Permissions.SetValue(ref allowValue, ref denyValue, useExternalSounds, ChannelPermission.UseExternalSounds);

AllowValue = allowValue;
DenyValue = denyValue;
Expand Down Expand Up @@ -220,12 +252,21 @@ public OverwritePermissions(
PermValue usePrivateThreads = PermValue.Inherit,
PermValue useExternalStickers = PermValue.Inherit,
PermValue sendMessagesInThreads = PermValue.Inherit,
PermValue startEmbeddedActivities = PermValue.Inherit)
PermValue startEmbeddedActivities = PermValue.Inherit,
PermValue useSoundboard = PermValue.Inherit,
PermValue createEvents = PermValue.Inherit,
PermValue sendVoiceMessages = PermValue.Inherit,
PermValue useClydeAI = PermValue.Inherit,
PermValue setVoiceChannelStatus = PermValue.Inherit,
PermValue sendPolls = PermValue.Inherit,
PermValue useExternalApps = PermValue.Inherit,
PermValue useExternalSounds = PermValue.Inherit)
: this(0, 0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages,
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers,
moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream, useSlashCommands, useApplicationCommands,
requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, usePublicThreads, usePrivateThreads, useExternalStickers,
sendMessagesInThreads, startEmbeddedActivities)
sendMessagesInThreads, startEmbeddedActivities, useSoundboard, createEvents, sendVoiceMessages, useClydeAI, setVoiceChannelStatus,
sendPolls, useExternalApps, useExternalSounds)
{ }

/// <summary>
Expand Down Expand Up @@ -265,12 +306,21 @@ public OverwritePermissions Modify(
PermValue? usePrivateThreads = null,
PermValue? useExternalStickers = null,
PermValue? sendMessagesInThreads = null,
PermValue? startEmbeddedActivities = null)
PermValue? startEmbeddedActivities = null,
PermValue? useSoundboard = null,
PermValue? createEvents = null,
PermValue? sendVoiceMessages = null,
PermValue? useClydeAI = null,
PermValue? setVoiceChannelStatus = null,
PermValue? sendPolls = null,
PermValue? useExternalApps = null,
PermValue? useExternalSounds = null)
=> new OverwritePermissions(AllowValue, DenyValue, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages,
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers,
moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream, useSlashCommands, useApplicationCommands,
requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, usePublicThreads, usePrivateThreads, useExternalStickers,
sendMessagesInThreads, startEmbeddedActivities);
sendMessagesInThreads, startEmbeddedActivities, useSoundboard, createEvents, sendVoiceMessages, useClydeAI, setVoiceChannelStatus,
sendPolls, useExternalApps, useExternalSounds);

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