diff --git a/src/Discord.Net.Interactions/Attributes/AutocompleteAttribute.cs b/src/Discord.Net.Interactions/Attributes/AutocompleteAttribute.cs
index c8a3428db4..71c1c16a4c 100644
--- a/src/Discord.Net.Interactions/Attributes/AutocompleteAttribute.cs
+++ b/src/Discord.Net.Interactions/Attributes/AutocompleteAttribute.cs
@@ -1,36 +1,38 @@
using System;
-namespace Discord.Interactions
+namespace Discord.Interactions;
+
+///
+/// Set the to .
+///
+[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
+public class AutocompleteAttribute : Attribute
{
///
- /// Set the to .
+ /// Type of the .
///
- [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
- public class AutocompleteAttribute : Attribute
- {
- ///
- /// Type of the .
- ///
- public Type AutocompleteHandlerType { get; }
+ 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)
- {
- if (!typeof(IAutocompleteHandler).IsAssignableFrom(autocompleteHandlerType))
- throw new InvalidOperationException($"{autocompleteHandlerType.FullName} isn't a valid {nameof(IAutocompleteHandler)} type");
-
- 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");
- ///
- /// Set the to without specifying a .
- ///
- public AutocompleteAttribute() { }
+ AutocompleteHandlerType = autocompleteHandlerType;
}
}
+
+///
+/// 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(typeof(T))
+ where T : class, IAutocompleteHandler;