BaleSharp 1.5.1

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

baleSharp

baleSharp is a powerful and easy-to-use C# library to create bots for Bale Messenger. Designed for developers aiming to build efficient, scalable, and maintainable bots with minimal effort.


Features

  • Intuitive API tailored for Bale Messenger bot development
  • Support for message handling, event listening, and reply management
  • Fully asynchronous operations for high performance
  • Easy integration with existing C# projects
  • Flexible and extensible architecture
  • Compatible with .NET 8.0 and newer

Example

using Bale;
using Newtonsoft.Json;


int YOUR_CHAT_ID = 000000000;
string token = "TOKEN";
Bale.Client cli = new Client(token);

Bale.Message m = await cli.SendMessage(YOUR_CHAT_ID, "This is the test of the First BaleSharp bot, Made by CodeWizaard");

Bale.User me = await cli.getMe();

Console.WriteLine($"bot {me.first_name} started...");


try
{
    cli.OnCommand = async (message, command, args) =>
    {
        switch (command)
        {
            case "start": await cli.reply_to(message, "Welcome to this bot, This bot is made by BaleSharp"); break;
        }
    };

    cli.OnMessage = async (message) =>
    {
        switch (message.text)
        {
            case "Inline":
                var key = new InlineKeyboardBuilder().AddButton("CallbackButton", "call")
                .NewRow()
                .AddButton("urlButton", url: "https://ble.ir/BaleSharp")
                .NewRow()
                .AddButton("copyTextButton", copyText:"text is copied")
                .Build();
                await cli.reply_to(message, "Here is some of Inline buttons", key); 
                break;
            case "Reply":
                var keyboard = new ReplyKeyboardBuilder().AddButton("Made by")
                .NewRow()
                .AddButton("BaleSharp")
                .Build();
                await cli.reply_to(message, "Here are some ReplyKeyboard buttons", keyboard);
                break;
            default:
                await cli.reply_to(message, $"You said : {message.text}");
                break;
        }
    };

    
    cli.OnCallbackQuery = async (callback_query) =>
    {
        switch (callback_query.data)
        {
            case "call":
                await cli.SendMessage(callback_query.from.id, "callback_query button clicked!");
                break;
        }
    };
    cli.StartReceiving();
    await Task.Delay(-1);
}catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}
finally
{
    cli.StopReceiving();
}

Installation

Install the balebot package via NuGet:

dotnet add package BaleSharp

Docs and News : @BaleSharp Support : @BleSharpGP

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 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.

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
2.1.1 92 5/31/2025
2.1.0 136 5/27/2025
2.0.0 132 5/25/2025
1.5.9-Beta 50 5/24/2025
1.5.8 136 5/18/2025
1.5.7 209 5/14/2025
1.5.7-Beta 231 5/12/2025
1.5.6 125 5/11/2025
1.5.6-Alpha 52 5/10/2025
1.5.5 131 5/8/2025
1.5.5-Fix 129 5/8/2025
1.5.4 136 5/5/2025
1.5.3 138 4/30/2025
1.5.2 143 4/29/2025
1.5.1 146 4/29/2025
1.4.2 144 4/29/2025
1.4.1 149 4/28/2025
1.4.0 142 4/28/2025
1.3.4 232 4/28/2025 1.3.4 is deprecated because it has critical bugs.
1.3.3 144 4/27/2025
1.3.2 145 4/27/2025
1.3.1 144 4/27/2025
1.2.1 142 4/27/2025
1.1.1 144 4/27/2025
1.1.0 147 4/27/2025
1.0.0 143 4/27/2025