ZiziBot.TelegramBot.Framework 226.7.9677.28345-beta

This is a prerelease version of ZiziBot.TelegramBot.Framework.
dotnet add package ZiziBot.TelegramBot.Framework --version 226.7.9677.28345-beta
                    
NuGet\Install-Package ZiziBot.TelegramBot.Framework -Version 226.7.9677.28345-beta
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZiziBot.TelegramBot.Framework" Version="226.7.9677.28345-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZiziBot.TelegramBot.Framework" Version="226.7.9677.28345-beta" />
                    
Directory.Packages.props
<PackageReference Include="ZiziBot.TelegramBot.Framework" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZiziBot.TelegramBot.Framework --version 226.7.9677.28345-beta
                    
#r "nuget: ZiziBot.TelegramBot.Framework, 226.7.9677.28345-beta"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZiziBot.TelegramBot.Framework@226.7.9677.28345-beta
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZiziBot.TelegramBot.Framework&version=226.7.9677.28345-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ZiziBot.TelegramBot.Framework&version=226.7.9677.28345-beta&prerelease
                    
Install as a Cake Tool

ZiziBot.TelegramBot

CI ZiziBot.TelegramBot.Framework

A command-based, middleware-driven Telegram bot framework for .NET 8/9/10, featuring a scoped execution pipeline, robust startup configuration validation, complete liveness/readiness health probes, and graceful engine lifecycle hooks.

Includes a ready-to-run minimal sample host in ASP.NET Core.


🚀 Key Features

  • Dual-Engine Update Pipeline: Seamless execution under Long Polling mode (ideal for local development) or Webhooks (ideal for production environments), with automatic routing fallback.
  • Attribute-Based Routing: Clean controller methods decorated with [Command], [TextCommand], [TypedCommand], [Callback], [InlineQuery], and [UpdateCommand] to route incoming Telegram payloads.
  • Middleware Pipeline: Support for custom before/after pipeline execution hooks (IBeforeCommand, IAfterCommand) executing within a scoped Dependency Injection (DI) lifecycle.
  • Dynamic Configuration Validation: Automatic, regex-based validation of bot tokens and engine parameters at startup to prevent invalid deployments.
  • Health Checks & Diagnostics: Built-in endpoints for /health (full diagnostics) and /health/ready (connectivity tests using GetMe() calls) to integrate with orchestrators.
  • Graceful Shutdown: Native lifecycle hooks that handle cancellation and clean teardown of both polling and webhook engines.
  • Throttled Diagnostics: Efficient update logging and diagnostics throttling to prevent logs flooding during active traffic.
  • Robust Exception Logging: Captured and logged full exception stack traces (such as on client library token rejection) for better troubleshooting.

📂 Project Structure

  • ZiziBot.TelegramBot.Framework/: The main reusable library containing:
    • Engines: BotPollingEngine and BotWebhookEngine transport implementations.
    • Handlers: The pipeline boundary, update router, and middleware executor.
    • Validation: Regex-based bot engine settings validation.
    • HealthChecks: Probe engines checking Telegram connectivity and webhooks.
  • ZiziBot.TelegramBot.Sample/: A sample ASP.NET Core host showcasing:
    • Command routing examples (text, callbacks, inline queries).
    • Custom before/after middleware pipeline wireup.
    • Dependency Injection setup in Program.cs.

🛠️ Quick Start

1. Prerequisites

  • .NET 8.0, 9.0, or 10.0 SDK
  • A Telegram bot token (from @BotFather)

2. Configuration

Configure the framework under the BotEngine section in your application settings (e.g., appsettings.Development.json):

{
  "BotEngine": {
    "EngineMode": "Auto",
    "ReplyMode": "ReplyToSender",
    "ExecutionMode": "Background",
    "Bot": [
      {
        "Name": "MainBot",
        "Token": "YOUR_TELEGRAM_BOT_TOKEN"
      }
    ]
  }
}

Note: Do not commit real tokens to source control. Prefer environment variables for secrets.

3. Build & Run

# Build solution
dotnet build ZiziBot.TelegramBot.slnx

# Run the sample host
dotnet run --project .\ZiziBot.TelegramBot.Sample

The sample app runs locally on http://localhost:5157.

4. Health Checks

Monitor the application's runtime status using the built-in probes:

  • Liveness probe: http://localhost:5157/health
  • Readiness probe (checks active bot connection): http://localhost:5157/health/ready

📖 Documentation & Guides

For deep-dive topics, check out the following resources:


💖 Shoutout

Thanks to JetBrains for providing us with <a href="https://www.jetbrains.com/?from=zizibot" target="_blank">dotUltimate</a> licenses.

<a href="https://www.jetbrains.com/?from=zizibot" target="_blank"> <img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg" alt="JetBrains logo." width="200"> </a>

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
226.7.9677.28345-beta 104 7/1/2026
226.6.9673.26693-beta 102 6/27/2026
226.6.9673.26277-beta 103 6/27/2026
226.6.9673.25181-beta 105 6/27/2026
226.6.9653.27790-beta 101 6/7/2026
226.6.9652.20707-beta 117 6/6/2026
226.6.9651.42537-beta 110 6/5/2026
226.5.9643.29552-beta 105 5/28/2026
226.5.9642.28888-beta 97 5/27/2026
226.5.9641.29477-beta 103 5/26/2026
226.5.9641.27947-beta 99 5/26/2026
226.5.9640.26309-beta 98 5/25/2026
226.5.9629.7382-beta 110 5/14/2026
226.5.9629.6978-beta 100 5/14/2026
226.5.9629.852-beta 103 5/14/2026
226.5.9628.56502 122 5/13/2026
226.5.133.928 100 5/13/2026
226.5.133.926 102 5/13/2026
225.9.9391.28146 359 9/17/2025
1.0.0 110 5/13/2026
Loading failed