BaleBot.Net
1.0.1
See the version list below for details.
dotnet add package BaleBot.Net --version 1.0.1
NuGet\Install-Package BaleBot.Net -Version 1.0.1
<PackageReference Include="BaleBot.Net" Version="1.0.1" />
<PackageVersion Include="BaleBot.Net" Version="1.0.1" />
<PackageReference Include="BaleBot.Net" />
paket add BaleBot.Net --version 1.0.1
#r "nuget: BaleBot.Net, 1.0.1"
#addin nuget:?package=BaleBot.Net&version=1.0.1
#tool nuget:?package=BaleBot.Net&version=1.0.1
این را به فارسی بخوانید (Persian)
BaleBot.Net
A .NET library for interacting with the Bale Messenger Bot API.
Installation
To use BaleBot.Net
in your project, add the NuGet package:
dotnet add package BaleBot.Net
Or, in the NuGet Package Manager Console:
Install-Package BaleBot.Net
Usage in ASP.NET Core Projects
Step 1: Add BaleBotClient to the Service Container
In your Program.cs, use the AddBaleBotClient extension method to register the BaleBotClient:
var builder = WebApplication.CreateBuilder(args);
// Add BaleBotClient to the service container
builder.Services.AddBaleBotClient("YOUR_BOT_TOKEN");
var app = builder.Build();
Step 2: Map the Webhook
Use the MapBaleBotWebhook extension method to configure the webhook endpoint. You can handle different types of updates (e.g., messages, edited messages, callback queries, etc.).
Example 1: Handling Specific Update Types
app.MapBaleBotWebhook(
appBaseUrl: "https://yourdomain.com",
handleMessage: async (message) =>
{
Console.WriteLine($"Received message: {message.Text}");
},
handleEditedMessage: async (editedMessage) =>
{
Console.WriteLine($"Edited message: {editedMessage.Text}");
},
handleCallbackQuery: async (callbackQuery) =>
{
Console.WriteLine($"Callback query: {callbackQuery.Data}");
},
handlePreCheckoutQuery: async (preCheckoutQuery) =>
{
Console.WriteLine($"Pre-checkout query: {preCheckoutQuery.InvoicePayload}");
}
);
Example 2: Handling All Updates in a Single Function
app.MapBaleBotWebhook(
appBaseUrl: "https://yourdomain.com",
handleUpdate: async (update) =>
{
switch (update)
{
case { Message: { } message }:
Console.WriteLine($"Received message: {message.Text}");
break;
case { EditedMessage: { } editedMessage }:
Console.WriteLine($"Edited message: {editedMessage.Text}");
break;
case { CallbackQuery: { } callbackQuery }:
Console.WriteLine($"Callback query: {callbackQuery.Data}");
break;
case { PreCheckoutQuery: { } preCheckoutQuery }:
Console.WriteLine($"Pre-checkout query: {preCheckoutQuery.InvoicePayload}");
break;
default:
Console.WriteLine("Unknown update type.");
break;
}
}
);
Step 3: Run the Application
Run your application, and the webhook will be automatically set up with a unique path. The bot will start receiving updates at the configured endpoint.
app.Run();
Work with Methods
var me = await bot.GetMe();
var message = await bot.SendMessage("123", $"Hi! I'm @{me.Username} !");
message = await bot.SendMessage(
chatId: "123",
text: "Hello, World! Reply with InlineKeyboardMarkup",
replyToMessageId: firstMessageId,
replyMarkup: new InlineKeyboardMarkup
{
InlineKeyboard =
[
[
new() { Text = "Text1", CallbackData = "test1" },
new() { Text = "Text2", CallbackData = "test2" }
]
]
}
);
Console.WriteLine($"Message Sent: {message.MessageId}");
There are lot of Samples at Sample Project
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 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. |
-
net8.0
-
net9.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.5.4 | 136 | 5/19/2025 |
1.5.3 | 124 | 5/11/2025 |
1.5.2 | 146 | 5/4/2025 |
1.5.1 | 137 | 5/4/2025 |
1.5.0 | 141 | 4/30/2025 |
1.4.2 | 126 | 4/29/2025 |
1.4.1 | 141 | 4/29/2025 |
1.4.0 | 136 | 4/29/2025 |
1.3.1 | 177 | 4/21/2025 |
1.3.0 | 184 | 4/16/2025 |
1.2.3 | 166 | 4/16/2025 |
1.2.2 | 191 | 4/13/2025 |
1.2.1 | 173 | 4/13/2025 |
1.2.0 | 168 | 4/13/2025 |
1.1.1 | 133 | 4/12/2025 |
1.1.0 | 127 | 4/12/2025 |
1.0.6 | 117 | 4/11/2025 |
1.0.5 | 114 | 4/11/2025 |
1.0.4 | 111 | 4/11/2025 |
1.0.3 | 125 | 4/11/2025 |
1.0.2 | 122 | 4/11/2025 |
1.0.1 | 120 | 4/11/2025 |
1.0.0 | 125 | 4/11/2025 |
0.1.1 | 155 | 4/9/2025 |
0.1.0 | 152 | 4/9/2025 |