TgContext 1.3.29
dotnet add package TgContext --version 1.3.29
NuGet\Install-Package TgContext -Version 1.3.29
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="TgContext" Version="1.3.29" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TgContext" Version="1.3.29" />
<PackageReference Include="TgContext" />
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 TgContext --version 1.3.29
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TgContext, 1.3.29"
#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 TgContext@1.3.29
#: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=TgContext&version=1.3.29
#tool nuget:?package=TgContext&version=1.3.29
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Just another custom tg framework
Configure appsettings.json
"TelegramContext": {
"DevTelegramToken": "<Your dev bot tg token or empty>",
"ProdTelegramToken": "<Your prod bot tg token>",
"DevTelegramChatId": <Dev chat id>,
"ProdTelegramChatId": <Prod chat id>,
"BotRestartsAfterMinutes": 360 //optional, by default 180
}
Configure Di
builder.Services.AddTelegramContext();
...
app.UseTelegramContext()
Usage
Default endpoint
[TelegramAuth(new long[] { <userId> })]
public class DefaultEndpoint : IDefaultTelegramEndpoint
{
public async Task Execute(Update update)
{
//code
}
}
Command registration example
[TelegramCommandEndpoint("content")]
[TelegramAuth(new long[] { <userId> })]
public class ContentCommand : ITelegramEndpoint
{
public async Task Execute(Update update)
{
//code
}
}
Button registration example
[TelegramButtonEndpoint("Add")]
[TelegramAuth(new long[]{ <userId> })]
public class AddContentButton : ITelegramEndpoint
{
public async Task Execute(Update update)
{
//code
}
}
OnState registration example
[TelegramOnStateEndpoint(States.ContentTypeSet)]
public async Task OnContentTypeSet(Update update)
{
//code
_telegramContext.SetState((<null or "newState">));;
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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.
-
net9.0
- JetBrains.Annotations (>= 2025.2.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.9)
- Telegram.Bot (>= 22.7.2)
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 |
|---|---|---|
| 1.3.29 | 191 | 9/14/2025 |
| 1.3.28 | 205 | 9/13/2025 |
| 1.3.27 | 231 | 8/10/2025 |
| 1.3.26 | 200 | 8/10/2025 |
| 1.3.25 | 352 | 8/10/2025 |
| 1.3.24 | 202 | 7/28/2025 |
| 1.3.23 | 554 | 7/21/2025 |
| 1.3.22 | 559 | 7/21/2025 |
| 1.3.21 | 254 | 11/5/2024 |
| 1.3.20 | 265 | 7/20/2024 |
| 1.3.19 | 193 | 7/20/2024 |
| 1.3.18 | 230 | 4/27/2024 |
| 1.3.17 | 207 | 4/27/2024 |
| 1.3.16 | 210 | 4/27/2024 |
| 1.3.15 | 216 | 4/27/2024 |
| 1.3.14 | 209 | 4/27/2024 |
| 1.3.13 | 211 | 4/18/2024 |
| 1.3.12 | 213 | 4/17/2024 |
| 1.0.0 | 199 | 11/5/2024 |
| 1.0.0-rc.7 | 85 | 11/5/2024 |
Loading failed