TgBotLib.Core
1.0.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package TgBotLib.Core --version 1.0.2
NuGet\Install-Package TgBotLib.Core -Version 1.0.2
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="TgBotLib.Core" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TgBotLib.Core" Version="1.0.2" />
<PackageReference Include="TgBotLib.Core" />
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 TgBotLib.Core --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TgBotLib.Core, 1.0.2"
#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 TgBotLib.Core@1.0.2
#: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=TgBotLib.Core&version=1.0.2
#tool nuget:?package=TgBotLib.Core&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Telegram bot lib
Пример
В Program.cs добавить следующую строку:
builder.Services.AddBotLibCore("<YOUR_BOT_TOKEN>");
Далее, по аналогии, можно добавить контроллеры
Пример стандартного контроллера:
public class TestController : BotController
{
private readonly IInlineButtonsGenerationService _buttonsGenerationService;
public TestController(IInlineButtonsGenerationService buttonsGenerationService)
{
_buttonsGenerationService = buttonsGenerationService;
}
[Message("Test")]
[Message(@"Test\d", isPattern: true)]
public Task TestMessage()
{
return Client.SendTextMessageAsync(BotContext.Update.GetChatId(), "Test message");
}
[Callback(@"Test")]
[Callback(@"\d", isPattern: true)]
public Task TestCallback()
{
return Client.SendTextMessageAsync(BotContext.Update.GetChatId(), "Test callback");
}
[Message("Buttons")]
public Task TestWithButtons()
{
_buttonsGenerationService.SetInlineButtons("Test", "2", "3");
return Client.SendTextMessageAsync(BotContext.Update.GetChatId(),
"Test buttons",
replyMarkup: _buttonsGenerationService.GetButtons());
}
[UnknownMessage]
public Task TestUnknownMessage()
{
return Client.SendTextMessageAsync(BotContext.Update.GetChatId(), "Hmm... 🤔");
}
}
Пример контроллера с обработкой последовательности:
public class SecondTestController : BotController
{
private readonly IUsersActionsService _usersActionsService;
public SecondTestController(IUsersActionsService usersActionsService)
{
_usersActionsService = usersActionsService;
}
[Message("Init handling")]
public async Task InitHandling()
{
_usersActionsService.HandleUser(BotContext.Update.GetChatId(), nameof(SecondTestController));
await Client.SendTextMessageAsync(BotContext.Update.GetChatId(), "Handling inited");
}
[ActionStep(nameof(SecondTestController), 0)]
public async Task FirstStep()
{
await Client.SendTextMessageAsync(BotContext.Update.GetChatId(), $"First step {BotContext.Update.GetMessageText()}");
}
[ActionStep(nameof(SecondTestController), 1)]
public async Task SecondStep()
{
await Client.SendTextMessageAsync(BotContext.Update.GetChatId(), $"Second step {BotContext.Update.GetMessageText()}");
}
[ActionStep(nameof(SecondTestController), 2)]
public async Task ThirdStep()
{
await Client.SendTextMessageAsync(BotContext.Update.GetChatId(), $"Third step {BotContext.Update.GetMessageText()}");
}
}
| Product | Versions 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 was computed. 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.
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Telegram.Bot (>= 19.0.0)
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.2.7 | 261 | 4/20/2024 |
| 1.2.6 | 223 | 4/13/2024 |
| 1.2.5 | 180 | 4/12/2024 |
| 1.2.4 | 168 | 4/12/2024 |
| 1.2.3 | 146 | 4/12/2024 |
| 1.2.2 | 184 | 4/12/2024 |
| 1.2.1 | 174 | 4/12/2024 |
| 1.2.0 | 164 | 4/12/2024 |
| 1.1.5 | 199 | 4/11/2024 |
| 1.1.4 | 153 | 4/10/2024 |
| 1.1.3 | 179 | 4/8/2024 |
| 1.1.2 | 163 | 4/8/2024 |
| 1.1.1 | 202 | 4/7/2024 |
| 1.1.0 | 168 | 4/7/2024 |
| 1.0.2 | 179 | 4/6/2024 |
| 1.0.1 | 180 | 4/6/2024 |
| 1.0.0 | 171 | 4/6/2024 |