From 30ccb2c83b414121c30f2c88b511f10b4d3ab6c6 Mon Sep 17 00:00:00 2001 From: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com> Date: Wed, 17 Jan 2024 01:25:57 +0300 Subject: [PATCH] Revert pr (Revert 12179a93d7aef4a07f2fb194f42e9d537941cefd) (#2826) --- .../Attributes/AutocompleteAttribute.cs | 64 ++++++++----------- .../Discord.Net.Interactions.csproj | 2 - 2 files changed, 27 insertions(+), 39 deletions(-) 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