diff --git a/src/Discord.Net.Interactions/Attributes/AutocompleteAttribute.cs b/src/Discord.Net.Interactions/Attributes/AutocompleteAttribute.cs index fc84d58f..c8a3428d 100644 --- a/src/Discord.Net.Interactions/Attributes/AutocompleteAttribute.cs +++ b/src/Discord.Net.Interactions/Attributes/AutocompleteAttribute.cs @@ -1,46 +1,36 @@ using System; -namespace Discord.Interactions; - -/// -/// Set the to . -/// -[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] -public class AutocompleteAttribute : Attribute +namespace Discord.Interactions { /// - /// Type of the . + /// Set the to . /// - public Type AutocompleteHandlerType { get; } - - /// - /// Set the to and define a to handle - /// Autocomplete interactions targeting the parameter this is applied to. - /// - /// - /// must be set to to use this constructor. - /// - public AutocompleteAttribute(Type autocompleteHandlerType) + [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public class AutocompleteAttribute : Attribute { - if (!typeof(IAutocompleteHandler).IsAssignableFrom(autocompleteHandlerType)) - throw new InvalidOperationException($"{autocompleteHandlerType.FullName} isn't a valid {nameof(IAutocompleteHandler)} type"); + /// + /// Type of the . + /// + public Type AutocompleteHandlerType { get; } - AutocompleteHandlerType = autocompleteHandlerType; + /// + /// Set the to and define a to handle + /// Autocomplete interactions targeting the parameter this is applied to. + /// + /// + /// must be set to to use this constructor. + /// + public AutocompleteAttribute(Type autocompleteHandlerType) + { + if (!typeof(IAutocompleteHandler).IsAssignableFrom(autocompleteHandlerType)) + throw new InvalidOperationException($"{autocompleteHandlerType.FullName} isn't a valid {nameof(IAutocompleteHandler)} type"); + + AutocompleteHandlerType = autocompleteHandlerType; + } + + /// + /// Set the to without specifying a . + /// + public AutocompleteAttribute() { } } - - /// - /// Set the to without specifying a . - /// - public AutocompleteAttribute() { } -} - -/// -/// Set the to . -/// -/// Type of the that will be used to handle Autocomplete interactions targeting the parameter. -[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] -public class AutocompleteAttribute : AutocompleteAttribute - where T : class, IAutocompleteHandler -{ - public AutocompleteAttribute() : base(typeof(T)) { } } diff --git a/src/Discord.Net.Interactions/Discord.Net.Interactions.csproj b/src/Discord.Net.Interactions/Discord.Net.Interactions.csproj index 653f746b..a3ac3d50 100644 --- a/src/Discord.Net.Interactions/Discord.Net.Interactions.csproj +++ b/src/Discord.Net.Interactions/Discord.Net.Interactions.csproj @@ -3,14 +3,12 @@ net6.0;net5.0;net461;netstandard2.0;netstandard2.1 - preview net6.0;net5.0;netstandard2.0;netstandard2.1 Discord.Interactions Discord.Net.Interactions A Discord.Net extension adding support for Application Commands. 5 True - true