Releases: bvdcode/TelegramBot.NET
Releases · bvdcode/TelegramBot.NET
Release 1.0.20
Add link to usage examples in README.md Added a hyperlink to the TelegramBot.ConsoleTest project in the README.md file. This link directs users to practical usage examples of the Telegram Bot API library, enhancing the documentation and aiding users in understanding how to implement the library.
Release 1.0.19
Merge branch 'main' of https://github.com/BigMakCode/TelegramBot.NET
Release 1.0.18
Refactor HostApplicationLifetime retrieval and registration Simplified and improved the retrieval and registration of the HostApplicationLifetime service in BotApp.cs and BotBuilder.cs. In BotApp.cs, the code now retrieves IHostApplicationLifetime and casts it to HostApplicationLifetime, throwing an InvalidOperationException if the cast fails. In BotBuilder.cs, the registration of HostApplicationLifetime has been simplified by removing the factory method and directly registering the service. These changes enhance the robustness and clarity of the code.
Release 1.0.17
Refactor BotApp to manage its own CancellationTokenSource The constructor of the `BotApp` class in the `TelegramBot` namespace has been modified to remove the `cancellationTokenSource` parameter. Instead, a new `CancellationTokenSource` instance is created within the constructor. In the `BotBuilder` class within the `TelegramBot.Builders` namespace, the instantiation of `CancellationTokenSource` has been removed, and the `BotApp` constructor is called without passing a `cancellationTokenSource` parameter. These changes simplify the instantiation process of `BotApp` by encapsulating the creation of `CancellationTokenSource` within the class itself.
Release 1.0.16
Improve concurrent stopping of hosted services Initialize a task list to track asynchronous stopping tasks of hosted services in the `TelegramBot` namespace within `BotApp.cs`. Modify the stopping logic to add each `StopAsync` task to the list and log the start of the stopping process. Await all tasks concurrently using `Task.WhenAll(tasks)` to potentially reduce the overall stopping time and provide clearer logging information.
Release 1.0.15
Merge branch 'main' of https://github.com/BigMakCode/TelegramBot.NET
Release 1.0.14
Add authorization for /help command and handler setup - Updated `HomeController.cs` to include two new methods for handling the `/help` command, one authorized and one not. - Modified `Program.cs` to include `TelegramBot.Extensions` namespace and use an authorization handler. - Added `AuthorizationHandler.cs` to define `AuthorizationHandler` class implementing `IBotAuthorizationHandler` for user ID-based authorization.
Release 1.0.13
Add authorization mechanism for Telegram bot messages Introduce a new authorization mechanism to enhance bot security. - Add `TelegramBot.Attributes` namespace in `BotApp.cs`. - Implement `AuthorizeAttribute` to mark methods/controllers. - Retrieve `IBotAuthorizationHandler` for authorization logic. - Handle unauthorized access without executing the method. - Update parameter count check to handle null `args`.
Release 1.0.12
Refactor: Move IHost implementation to IBot interface The BotApp class no longer implements the IHost interface directly. Instead, the IBot interface now extends IHost, centralizing hosting responsibilities within the IBot interface. This change ensures that any class implementing IBot will also need to implement IHost. Additionally, the necessary using directive for Microsoft.Extensions.Hosting was added to IBot.cs.
Release 1.0.11
Implement IHost in BotApp and enhance lifecycle management BotApp.cs: - Implemented IHost interface in BotApp class. - Added private field _disposed to track disposal state. - Added CancellationTokenSource field _cancellationTokenSource. - Updated constructor to accept a CancellationTokenSource parameter. - Updated Run method to use a merged cancellation token. - Added StartAsync, StopAsync, Dispose, and MergeTokens methods. - Updated ErrorHandler, UpdateHandler, and HandleRequestAsync to call CheckDisposed. - Added private method CheckDisposed to throw ObjectDisposedException. BotBuilder.cs: - Updated BotBuilder to create and pass a CancellationTokenSource to BotApp. HostApplicationLifetime.cs: - Updated to accept a CancellationTokenSource through its constructor. - Removed creation of its own CancellationTokenSource.