BaseBotLib_Pilyukov 1.0.17

dotnet add package BaseBotLib_Pilyukov --version 1.0.17                
NuGet\Install-Package BaseBotLib_Pilyukov -Version 1.0.17                
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="BaseBotLib_Pilyukov" Version="1.0.17" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BaseBotLib_Pilyukov --version 1.0.17                
#r "nuget: BaseBotLib_Pilyukov, 1.0.17"                
#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.
// Install BaseBotLib_Pilyukov as a Cake Addin
#addin nuget:?package=BaseBotLib_Pilyukov&version=1.0.17

// Install BaseBotLib_Pilyukov as a Cake Tool
#tool nuget:?package=BaseBotLib_Pilyukov&version=1.0.17                

BaseBotLib

BaseBotLib is a .NET/.NET Core library for creating Telegram bots.


NuGet version NuGet downloads

Get Started

  1. Create a new bot using BotFather and obtain the botId and token.

  2. Install the standard Nuget package into your application.

    CLI : dotnet add package BaseBotLib_Pilyukov
    Package Manager : Install-Package BaseBotLib_Pilyukov
    Rider / Visual Studio : Manage NuGet Packages -> Search for BaseBotLib_Pilyukov -> Install
    

Example

A simple way to receive new messages and respond to them :

using BaseBotLib.Interfaces.Bot;
using BaseBotLib.Services.Bot;

private async Task StartBot(string botId, string botToken)
{
    var bot = new Bot(botId, botToken);
    
    while (true)
    {
        var newMessages = await bot.GetNewMessages();

        foreach (var newMessage in newMessages)
        {
            Console.WriteLine($"New message : \"{newMessage.Text}\" from user \"{newMessage.UserName}\".");
            await ProcessMessage(bot, newMessage);
        }

        await Task.Delay(20);
    }
}

The message handler function can look like this :

private async Task ProcessMessage(IBot bot, Message message)
{
    var msg = message.Text?.ToLower();

    switch (msg)
    {
        case "hi":
            await bot.SendMessage(message.ChatId, $"Hi {message.UserName}");
            break;
        case "bye":
            await bot.SendMessage(message.ChatId, $"Bye {message.UserName}");
            break;
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.17 45 1/25/2025
1.0.16 249 12/12/2023
1.0.15 135 12/12/2023
1.0.14 134 12/12/2023
1.0.13 499 2/19/2022
1.0.12 449 2/19/2022
1.0.11 466 2/19/2022
1.0.10 431 2/6/2022
1.0.9 364 3/30/2021
1.0.8 436 11/4/2020
1.0.7 483 8/12/2020
1.0.6 424 8/12/2020
1.0.5 629 7/4/2020
1.0.4 487 7/3/2020
1.0.3 533 7/3/2020
1.0.1 440 7/3/2020
1.0.0 487 6/6/2020