Deployf.Botf 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Deployf.Botf --version 0.1.1
NuGet\Install-Package Deployf.Botf -Version 0.1.1
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="Deployf.Botf" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Deployf.Botf --version 0.1.1
#r "nuget: Deployf.Botf, 0.1.1"
#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 Deployf.Botf as a Cake Addin
#addin nuget:?package=Deployf.Botf&version=0.1.1

// Install Deployf.Botf as a Cake Tool
#tool nuget:?package=Deployf.Botf&version=0.1.1

BotF

Nuget GitHub

Make beautiful and clear telegram bots with the asp.net-like architecture!

BotF have next features:

  • long pooling and webhook mode without any changes in the code
  • very convinient way to work with commands and reply buttons
  • integrated pagination with buttons
  • authentication and role-based authorization
  • statemachine for complicated dialogs with users
  • asp.net-like approach to develop bots
  • good performance

Documentaion

Visit to our wiki to read botf documentation

Install

dotnet add package Deployf.Botf

Example

Put next code into Program.cs file

using Deployf.Botf;
using Deployf.Botf.Controllers;

class Program : BotfProgram
{
    // It's boilerplate program entrypoint.
    // We just simplified all usual code into static method StartBot.
    // But in this case of starting of the bot, you should add a config section under "bot" key to appsettings.json
    public static void Main(string[] args) => StartBot(args);

    // Action attribute mean that you mark async method `Start`
    // as handler for user's text in message which equal to '/start' string.
    // You can name method as you want
    [Action("/start")]
    public async Task Start()
    {
        // Just sending a reply message to user. Very simple, isn't?
        await Send($"Send `{nameof(Hello)}` to me, please!");
    }

    // If we dont put any parameter into Action attribute,
    // it means that this method will handle messages with hame of the method.
    // Yep, in this case, you should care about the method's name.
    [Action]
    public async Task Hello()
    {
        await Send("Hey! Thank you! That's it.");
    }

    // Here we handle all unknown command or just text sent from user
    [On(Handle.Unknown)] 
    public async Task Unknown()
    {
        // Here, we use the so-called "buffering of sending message"
        // It means you dont need to construct all message in the string and send it once
        // You can use Push to just add the text to result message, or PushL - the same but with new line after the string.
        PushL("You know.. it's very hard to recognize your command!");
        PushL("Please, write a correct text. Or use /start command");
        
        // And finally, send buffered message
        await Send();
    }
}

And replace content of appsettings.json with your bot username and token:

{
  "bot": {
    "Token": "123456778990:YourToken",
    "Username": "username_bot"
  }
}

And that's it! Veeery easy, isn't?
Just run the program 😃

Other examples you can find in /Examples folder.

Hosting

After you develop your bot, you can deploy it to out hosting: deploy-f.com

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 was computed.  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. 
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
0.17.3 385 9/23/2023
0.17.2 108 9/23/2023
0.17.1 5,328 5/9/2023
0.17.0 138 5/8/2023
0.16.0 541 11/26/2022
0.15.2 10,495 11/24/2022
0.15.1 348 11/14/2022
0.15.0 343 11/10/2022
0.14.3 336 11/9/2022
0.14.2 422 10/14/2022
0.14.1 389 10/14/2022
0.14.0 554 8/6/2022
0.13.1 415 7/28/2022
0.13.0 428 7/27/2022
0.12.0 646 4/9/2022
0.11.0 443 4/4/2022
0.10.0 464 3/29/2022
0.9.0 434 3/26/2022
0.8.2 497 2/6/2022
0.8.1 482 1/30/2022
0.8.0 471 1/26/2022
0.7.2 463 1/22/2022
0.7.1 457 1/15/2022
0.7.0 302 1/3/2022
0.6.0 318 12/22/2021
0.5.1 342 12/13/2021
0.5.0 328 12/12/2021
0.4.0 301 12/2/2021
0.3.0 342 11/8/2021
0.1.1 349 11/2/2021
0.1.0.1 377 11/2/2021