diff --git a/src/Discord.Net.Interactions/Attributes/DefaultMemberPermissionAttribute.cs b/src/Discord.Net.Interactions/Attributes/DefaultMemberPermissionAttribute.cs
new file mode 100644
index 000000000..ec79da1e3
--- /dev/null
+++ b/src/Discord.Net.Interactions/Attributes/DefaultMemberPermissionAttribute.cs
@@ -0,0 +1,25 @@
+using System;
+
+namespace Discord.Interactions
+{
+ ///
+ /// Sets the of an application command or module.
+ ///
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
+ public class DefaultMemberPermissionsAttribute : Attribute
+ {
+ ///
+ /// Gets the default permission required to use this command.
+ ///
+ public GuildPermission Permissions { get; }
+
+ ///
+ /// Sets the of an application command or module.
+ ///
+ /// The default permission required to use this command.
+ public DefaultMemberPermissionsAttribute(GuildPermission permissions)
+ {
+ Permissions = permissions;
+ }
+ }
+}
diff --git a/src/Discord.Net.Interactions/Attributes/DefaultPermissionAttribute.cs b/src/Discord.Net.Interactions/Attributes/DefaultPermissionAttribute.cs
index ed0a532be..2e03dfac6 100644
--- a/src/Discord.Net.Interactions/Attributes/DefaultPermissionAttribute.cs
+++ b/src/Discord.Net.Interactions/Attributes/DefaultPermissionAttribute.cs
@@ -6,6 +6,7 @@ namespace Discord.Interactions
/// Set the "Default Permission" property of an Application Command.
///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
+ [Obsolete($"Soon to be deprecated, use Permissions-v2 attributes like {nameof(EnabledInDmAttribute)} and {nameof(DefaultMemberPermissionsAttribute)}")]
public class DefaultPermissionAttribute : Attribute
{
///
diff --git a/src/Discord.Net.Interactions/Attributes/EnabledInDmAttribute.cs b/src/Discord.Net.Interactions/Attributes/EnabledInDmAttribute.cs
new file mode 100644
index 000000000..a97f85a25
--- /dev/null
+++ b/src/Discord.Net.Interactions/Attributes/EnabledInDmAttribute.cs
@@ -0,0 +1,25 @@
+using System;
+
+namespace Discord.Interactions
+{
+ ///
+ /// Sets the property of an application command or module.
+ ///
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
+ public class EnabledInDmAttribute : Attribute
+ {
+ ///
+ /// Gets whether or not this command can be used in DMs.
+ ///
+ public bool IsEnabled { get; }
+
+ ///
+ /// Sets the property of an application command or module.
+ ///
+ /// Whether or not this command can be used in DMs.
+ public EnabledInDmAttribute(bool isEnabled)
+ {
+ IsEnabled = isEnabled;
+ }
+ }
+}
diff --git a/src/Discord.Net.Interactions/Builders/Commands/ContextCommandBuilder.cs b/src/Discord.Net.Interactions/Builders/Commands/ContextCommandBuilder.cs
index d40547b3c..be0e5eb70 100644
--- a/src/Discord.Net.Interactions/Builders/Commands/ContextCommandBuilder.cs
+++ b/src/Discord.Net.Interactions/Builders/Commands/ContextCommandBuilder.cs
@@ -17,8 +17,19 @@ namespace Discord.Interactions.Builders
///
/// Gets the default permission of this command.
///
+ [Obsolete($"To be deprecated soon, use {nameof(IsEnabledInDm)} and {nameof(DefaultMemberPermissions)} instead.")]
public bool DefaultPermission { get; set; } = true;
+ ///
+ /// Gets whether this command can be used in DMs.
+ ///
+ public bool IsEnabledInDm { get; set; } = true;
+
+ ///
+ /// Gets the default permissions needed for executing this command.
+ ///
+ public GuildPermission? DefaultMemberPermissions { get; set; } = null;
+
internal ContextCommandBuilder (ModuleBuilder module) : base(module) { }
///
@@ -49,6 +60,7 @@ namespace Discord.Interactions.Builders
///
/// The builder instance.
///
+ [Obsolete($"To be deprecated soon, use {nameof(SetEnabledInDm)} and {nameof(WithDefaultMemberPermissions)} instead.")]
public ContextCommandBuilder SetDefaultPermission (bool defaultPermision)
{
DefaultPermission = defaultPermision;
@@ -70,6 +82,32 @@ namespace Discord.Interactions.Builders
return this;
}
+ ///
+ /// Sets .
+ ///
+ /// New value of the .
+ ///
+ /// The builder instance.
+ ///
+ public ContextCommandBuilder SetEnabledInDm(bool isEnabled)
+ {
+ IsEnabledInDm = isEnabled;
+ return this;
+ }
+
+ ///
+ /// Sets .
+ ///
+ /// New value of the .
+ ///
+ /// The builder instance.
+ ///
+ public ContextCommandBuilder WithDefaultMemberPermissions(GuildPermission permissions)
+ {
+ DefaultMemberPermissions = permissions;
+ return this;
+ }
+
internal override ContextCommandInfo Build (ModuleInfo module, InteractionService commandService) =>
ContextCommandInfo.Create(this, module, commandService);
}
diff --git a/src/Discord.Net.Interactions/Builders/Commands/SlashCommandBuilder.cs b/src/Discord.Net.Interactions/Builders/Commands/SlashCommandBuilder.cs
index d8e9b0658..cd9bdfc24 100644
--- a/src/Discord.Net.Interactions/Builders/Commands/SlashCommandBuilder.cs
+++ b/src/Discord.Net.Interactions/Builders/Commands/SlashCommandBuilder.cs
@@ -17,8 +17,19 @@ namespace Discord.Interactions.Builders
///
/// Gets and sets the default permission of this command.
///
+ [Obsolete($"To be deprecated soon, use {nameof(IsEnabledInDm)} and {nameof(DefaultMemberPermissions)} instead.")]
public bool DefaultPermission { get; set; } = true;
+ ///
+ /// Gets whether this command can be used in DMs.
+ ///
+ public bool IsEnabledInDm { get; set; } = true;
+
+ ///
+ /// Gets the default permissions needed for executing this command.
+ ///
+ public GuildPermission? DefaultMemberPermissions { get; set; } = null;
+
internal SlashCommandBuilder (ModuleBuilder module) : base(module) { }
///
@@ -49,6 +60,7 @@ namespace Discord.Interactions.Builders
///
/// The builder instance.
///
+ [Obsolete($"To be deprecated soon, use {nameof(SetEnabledInDm)} and {nameof(WithDefaultMemberPermissions)} instead.")]
public SlashCommandBuilder WithDefaultPermission (bool permission)
{
DefaultPermission = permission;
@@ -70,6 +82,32 @@ namespace Discord.Interactions.Builders
return this;
}
+ ///
+ /// Sets .
+ ///
+ /// New value of the .
+ ///
+ /// The builder instance.
+ ///
+ public SlashCommandBuilder SetEnabledInDm(bool isEnabled)
+ {
+ IsEnabledInDm = isEnabled;
+ return this;
+ }
+
+ ///
+ /// Sets .
+ ///
+ /// New value of the .
+ ///
+ /// The builder instance.
+ ///
+ public SlashCommandBuilder WithDefaultMemberPermissions(GuildPermission permissions)
+ {
+ DefaultMemberPermissions = permissions;
+ return this;
+ }
+
internal override SlashCommandInfo Build (ModuleInfo module, InteractionService commandService) =>
new SlashCommandInfo(this, module, commandService);
}
diff --git a/src/Discord.Net.Interactions/Builders/ModuleBuilder.cs b/src/Discord.Net.Interactions/Builders/ModuleBuilder.cs
index 40c263643..b7f00025f 100644
--- a/src/Discord.Net.Interactions/Builders/ModuleBuilder.cs
+++ b/src/Discord.Net.Interactions/Builders/ModuleBuilder.cs
@@ -51,8 +51,19 @@ namespace Discord.Interactions.Builders
///
/// Gets and sets the default permission of this module.
///
+ [Obsolete($"To be deprecated soon, use {nameof(IsEnabledInDm)} and {nameof(DefaultMemberPermissions)} instead.")]
public bool DefaultPermission { get; set; } = true;
+ ///
+ /// Gets whether this command can be used in DMs.
+ ///
+ public bool IsEnabledInDm { get; set; } = true;
+
+ ///
+ /// Gets the default permissions needed for executing this command.
+ ///
+ public GuildPermission? DefaultMemberPermissions { get; set; } = null;
+
///
/// Gets and sets whether this has a .
///
@@ -159,12 +170,39 @@ namespace Discord.Interactions.Builders
///
/// The builder instance.
///
+ [Obsolete($"To be deprecated soon, use {nameof(SetEnabledInDm)} and {nameof(WithDefaultMemberPermissions)} instead.")]
public ModuleBuilder WithDefaultPermission (bool permission)
{
DefaultPermission = permission;
return this;
}
+ ///
+ /// Sets .
+ ///
+ /// New value of the .
+ ///
+ /// The builder instance.
+ ///
+ public ModuleBuilder SetEnabledInDm(bool isEnabled)
+ {
+ IsEnabledInDm = isEnabled;
+ return this;
+ }
+
+ ///
+ /// Sets .
+ ///
+ /// New value of the .
+ ///
+ /// The builder instance.
+ ///
+ public ModuleBuilder WithDefaultMemberPermissions(GuildPermission permissions)
+ {
+ DefaultMemberPermissions = permissions;
+ return this;
+ }
+
///
/// Adds attributes to .
///
diff --git a/src/Discord.Net.Interactions/Builders/ModuleClassBuilder.cs b/src/Discord.Net.Interactions/Builders/ModuleClassBuilder.cs
index b2317d1f3..1bbdfcc4a 100644
--- a/src/Discord.Net.Interactions/Builders/ModuleClassBuilder.cs
+++ b/src/Discord.Net.Interactions/Builders/ModuleClassBuilder.cs
@@ -85,6 +85,16 @@ namespace Discord.Interactions.Builders
builder.DefaultPermission = defPermission.IsDefaultPermission;
}
break;
+ case EnabledInDmAttribute enabledInDm:
+ {
+ builder.IsEnabledInDm = enabledInDm.IsEnabled;
+ }
+ break;
+ case DefaultMemberPermissionsAttribute memberPermission:
+ {
+ builder.DefaultMemberPermissions = memberPermission.Permissions;
+ }
+ break;
case PreconditionAttribute precondition:
builder.AddPreconditions(precondition);
break;
@@ -169,6 +179,16 @@ namespace Discord.Interactions.Builders
builder.DefaultPermission = defaultPermission.IsDefaultPermission;
}
break;
+ case EnabledInDmAttribute enabledInDm:
+ {
+ builder.IsEnabledInDm = enabledInDm.IsEnabled;
+ }
+ break;
+ case DefaultMemberPermissionsAttribute memberPermission:
+ {
+ builder.DefaultMemberPermissions = memberPermission.Permissions;
+ }
+ break;
case PreconditionAttribute precondition:
builder.WithPreconditions(precondition);
break;
@@ -211,6 +231,16 @@ namespace Discord.Interactions.Builders
builder.DefaultPermission = defaultPermission.IsDefaultPermission;
}
break;
+ case EnabledInDmAttribute enabledInDm:
+ {
+ builder.IsEnabledInDm = enabledInDm.IsEnabled;
+ }
+ break;
+ case DefaultMemberPermissionsAttribute memberPermission:
+ {
+ builder.DefaultMemberPermissions = memberPermission.Permissions;
+ }
+ break;
case PreconditionAttribute precondition:
builder.WithPreconditions(precondition);
break;