* Renamed "concurrency" parameters in handlers attributes to more relevant and intuitive "importance" parameter
* Added debug logging helper that use default Debug tracer to trace filter, providers, routers and pool execution * Added debug logging for failing during handlers resolving, filters * Added new "CreateEmptyBuilder" methods for TelegramBotHost class * Addede ability to name handlers using "DisplayNameAttribute". This name is writed to descriptor's "DisplayString" property * Fixed missing summaries inside Hosting library
This commit is contained in:
@@ -10,8 +10,8 @@ namespace Telegrator.Handlers
|
||||
/// Attribute that marks a handler to process any type of update.
|
||||
/// This handler will be triggered for all incoming updates regardless of their type.
|
||||
/// </summary>
|
||||
/// <param name="concurrency">The maximum number of concurrent executions allowed (default: -1 for unlimited).</param>
|
||||
public class AnyUpdateHandlerAttribute(int concurrency = -1) : UpdateHandlerAttribute<AnyUpdateHandler>(UpdateType.Unknown, concurrency)
|
||||
/// <param name="importance"></param>
|
||||
public class AnyUpdateHandlerAttribute(int importance = -1) : UpdateHandlerAttribute<AnyUpdateHandler>(UpdateType.Unknown, importance)
|
||||
{
|
||||
/// <summary>
|
||||
/// Always returns true, allowing any update to pass through this filter.
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Telegrator.Handlers.Building.Components
|
||||
/// <returns>The builder instance.</returns>
|
||||
public void SetConcurreny(int concurrency)
|
||||
{
|
||||
Indexer = Indexer.UpdateConcurrency(concurrency);
|
||||
Indexer = Indexer.UpdateImportance(concurrency);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -10,15 +10,15 @@ namespace Telegrator.Handlers
|
||||
/// Attribute that marks a handler to process callback query updates.
|
||||
/// This handler will be triggered when users interact with inline keyboards or other callback mechanisms.
|
||||
/// </summary>
|
||||
/// <param name="concurrency">The maximum number of concurrent executions allowed (default: 0 for unlimited).</param>
|
||||
public sealed class CallbackQueryHandlerAttribute(int concurrency = 0) : UpdateHandlerAttribute<CallbackQueryHandler>(UpdateType.CallbackQuery, concurrency)
|
||||
/// <param name="importance"></param>
|
||||
public sealed class CallbackQueryHandlerAttribute(int importance = 0) : UpdateHandlerAttribute<CallbackQueryHandler>(UpdateType.CallbackQuery, importance)
|
||||
{
|
||||
/// <summary>
|
||||
/// Always returns true, allowing any callback query update to pass through this filter.
|
||||
/// </summary>
|
||||
/// <param name="context">The filter execution context (unused).</param>
|
||||
/// <returns>Always returns true to allow any callback query update.</returns>
|
||||
public override bool CanPass(FilterExecutionContext<Update> context) => true;
|
||||
public override bool CanPass(FilterExecutionContext<Update> context) => context.Input is { CallbackQuery: { } };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,8 +9,7 @@ namespace Telegrator.Handlers
|
||||
/// Attribute that marks a handler to process command messages.
|
||||
/// This handler will be triggered when users send bot commands (messages starting with '/').
|
||||
/// </summary>
|
||||
/// <param name="concurrency">The maximum number of concurrent executions allowed (default: 1).</param>
|
||||
public class CommandHandlerAttribute(int concurrency = 1) : UpdateHandlerAttribute<CommandHandler>(UpdateType.Message, concurrency)
|
||||
public class CommandHandlerAttribute(int importance = 1) : UpdateHandlerAttribute<CommandHandler>(UpdateType.Message, importance)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the command that was extracted from the message (without the '/' prefix and bot username).
|
||||
|
||||
@@ -12,8 +12,7 @@ namespace Telegrator.Handlers
|
||||
/// Attribute that marks a handler to process message updates.
|
||||
/// This handler will be triggered when users send messages in chats.
|
||||
/// </summary>
|
||||
/// <param name="concurrency">The maximum number of concurrent executions allowed (default: 0 for unlimited).</param>
|
||||
public class MessageHandlerAttribute(int concurrency = 0) : UpdateHandlerAttribute<MessageHandler>(UpdateType.Message, concurrency)
|
||||
public class MessageHandlerAttribute(int importance = 0) : UpdateHandlerAttribute<MessageHandler>(UpdateType.Message, importance)
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if the update contains a valid message.
|
||||
|
||||
Reference in New Issue
Block a user