diff --git a/Telegrator/Providers/HandlersCollection.cs b/Telegrator/Providers/HandlersCollection.cs index 2f0f7f3..f683611 100644 --- a/Telegrator/Providers/HandlersCollection.cs +++ b/Telegrator/Providers/HandlersCollection.cs @@ -16,7 +16,10 @@ namespace Telegrator.Providers /// Optional configuration options for handler collecting. public class HandlersCollection(ITelegratorOptions? options) : IHandlersCollection { - private readonly List _allowedTypes = []; + /// + /// Gets the collection of 's allowed by registered handlers + /// + protected readonly List _allowedTypes = []; /// /// Dictionary that organizes handler descriptors by update type. @@ -71,9 +74,8 @@ namespace Telegrator.Providers throw new Exception("This handler (" + descriptor.HandlerType.FullName + "), must contain constructor without parameters."); _allowedTypes.UnionAdd(descriptor.UpdateType); - MightAwaitAttribute[] mightAwaits = descriptor.HandlerType.GetCustomAttributes().ToArray(); - if (mightAwaits.Length > 0) - _allowedTypes.UnionAdd(mightAwaits.SelectMany(attr => attr.UpdateTypes)); + foreach (MightAwaitAttribute mightAwaits in descriptor.HandlerType.GetCustomAttributes()) + _allowedTypes.UnionAdd(mightAwaits.UpdateTypes); IntersectCommands(descriptor); HandlerDescriptorList list = GetDescriptorList(descriptor);