* Improved "MessageChatTypeFilter", now accepts flagged version of "ChatType" enum. "ChatTypeFlags"

* Added classes to reactive update filter annotations implementation "FilterAnnotation"
* "CollectHandlersDowmainWide" method moved as extension to IHandlersCollection and added method "CollectHandlerAssemblyWide" named respectfully
* Added "DefaultRouterExceptionHandler" to reactive implement "IRouterExceptionHandler" from function delegate
* Small bug fixes in API overview generator logic
This commit is contained in:
2025-07-26 21:03:42 +04:00
parent cec7c88b6a
commit b86699a65e
17 changed files with 307 additions and 93 deletions
@@ -0,0 +1,36 @@
using Telegram.Bot;
using Telegram.Bot.Polling;
using Telegrator.MadiatorCore;
namespace Telegrator.Polling
{
/// <summary>
/// Delegate used to handle <see cref="IUpdateRouter"/> exception
/// </summary>
/// <param name="botClient"></param>
/// <param name="exception"></param>
/// <param name="source"></param>
/// <param name="cancellationToken"></param>
public delegate void RouterExceptionHandler(ITelegramBotClient botClient, Exception exception, HandleErrorSource source, CancellationToken cancellationToken);
/// <summary>
/// Realizes <see cref="IRouterExceptionHandler"/> using function delegate
/// </summary>
/// <param name="handler"></param>
public sealed class DefaultRouterExceptionHandler(RouterExceptionHandler handler) : IRouterExceptionHandler
{
private readonly RouterExceptionHandler _handler = handler;
/// <inheritdoc/>
public void HandleException(ITelegramBotClient botClient, Exception exception, HandleErrorSource source, CancellationToken cancellationToken)
{
try
{
_handler.Invoke(botClient, exception, source, cancellationToken);
}
finally
{
_ = 0xBAD + 0xC0DE;
}
}}
}