TelegramBots - News @tgbots_dotnet Channel on Telegram

TelegramBots - News

@tgbots_dotnet


Here we share the news of our projects on TelegramBots organization.

Join our supergroup to talk about Telegram bots on .NET
https://t.me/joinchat/B35YY0QbLfd034CFnvCtCA


https://github.com/TelegramBots

TelegramBots - News (English)

Are you interested in Telegram bots and development on .NET platform? Look no further! Welcome to TelegramBots - News, your go-to channel for all the latest updates on projects by the TelegramBots organization. Stay informed about the newest developments, features, and releases within the world of Telegram bots.

Join our supergroup to engage in discussions, share ideas, and learn from fellow enthusiasts about creating amazing bots on .NET. Connect with like-minded individuals, ask questions, and stay up-to-date on the most innovative bot-building techniques.

Don't miss out on the opportunity to be part of a vibrant community dedicated to enhancing the Telegram experience through cutting-edge bot technology. Follow us on Telegram at @tgbots_dotnet and join our supergroup at https://t.me/joinchat/B35YY0QbLfd034CFnvCtCA to be a part of the conversation.

For more information and access to our projects, visit https://github.com/TelegramBots. Join us today and let's revolutionize the world of Telegram bots together!

TelegramBots - News

03 Jan, 14:17


Telegram.Bot v22.3.0 is available on Nuget!

What's new:
- Support for Bot API 8.2
- Renamed class Telegram.Bot.Types.File as TGFile
(the name File was annoyingly conflicting with the often-used System.IO.File class)
- Added property Token to TelegramBotClient
(you can use it to ParseValidateData MiniApp requests, authenticate WebHook updates, ...)

Note: we didn't add it to ITelegramBotClient to limit this "secret" from being leaked when sharing bot as interface.

Installation | Migration guide | Docs | Donate

TelegramBots - News

04 Dec, 15:07


Telegram.Bot v22.2.0 is available on Nuget!

What's new:
- Support for Bot API 8.1
- Support for Native AOT / Blazor / Trimming
(this is still experimental and we would enjoy your feedback if you try to use the library in such contexts)

Installation | Migration guide for v22 | Docs | Donate

TelegramBots - News

18 Nov, 11:33


Telegram.Bot v22.1.3 is available on Nuget!

What's new:
- Support for Bot API 8.0
- new helper message.MessageLink() to get the t.me link to that message (Supergroup and Channel only)
- ToHtml/ToMarkdown: support for ExpandableBlockquote (v22.1.1)
- fix savePreparedInlineMessage request (v22.1.2)
- TransactionPartnerUser.Gift type was corrected in Bot API (v22.1.3)

Our old nuget.voids.site feed is no more, so please remove this line from your nuget.config file, or from your IDE settings (Package sources), as we are back on nuget.org

Installation | Migration guide for v22 | Docs | Donate

TelegramBots - News

04 Nov, 00:18


🎉 Telegram.Bot v22.0.2 is available ON NUGET․ORG !

What's new:
- Support for Bot API 7.11
- Implicit conversions for single-field structures
- Implicit conversion from FileBase classes to InputFile
- Helper method GetFileIdType
- Huge rewrite of our serialization code to make it more performant and straightforward.
- Updated STJ due to vulnerability CVE-2024-43485
- Fix: allowPaidBroadcast support (v22.0.1)

Breaking changes:
As previously announced, we renamed most methods by removing the Async suffix and reordered a few arguments to place useful ones near the start of parameters list.
👉 For the moment, we still support the old methods, they will produce "Obsolete method" compiler warnings but your existing code should work fine.


Adapt your code easily:
With just 4 Find & Replace operations, you should be able to modify your code for v22.* and make these warnings go away.
Click here to follow our recommended steps

Installation | Migration guide for v22 | Docs | Donate

TelegramBots - News

11 Oct, 23:51


🤖 Introducing @WTelegramBot (the bot, not the library)

This inline bot has a lot of answers to bot programming questions, with link to documentation and examples.
It also contains description/parameters for every Bot API method.
(it will be continuously improved as I see new articles or information to add)

Just type @WTelegramBot followed by a small number of keywords/topics related to your question.
For example, try: @WTelegramBot chat

The bot will show you a list of possible articles matching your topic, and you can click on one to post the full article in the current chat.

You may use it:
- in private chat with the bot
- in our support chat (to help answer other people)
- or in any chat you want

TelegramBots - News

11 Oct, 22:10


ℹ️ Announcement ℹ️

As you know, since I took the development lead of this library, I'm particularly attached to making developers' life simpler by adding helpers class, implicit conversions, ensuring better compatibility for legacy code, avoiding breaking code, providing smooth migration paths, better documentation and fast upgrades for new Bot API...

However, when comes the time for the next Bot API version, we will be switching from v21.* to v22 because there will be two major breaking changes:

1) We will be removing the "Async" suffix at the end of all our method names

Our library is fully asynchronous, so it is obvious our API methods should be awaited. There is no mix with non-async methods here. The suffix just makes the names longer unnecessarily and mismatch with the method names from official Bot API documentation.

2) We will do a limited reordering of a few optional parameters (with no change to argument names)
The aim is to move the lesser used method arguments later down the argument list (typically: message_thread_id/entities)
and move the more useful arguments up closer to the beginning (typically: replyParameters/replyMarkup)
For new code, this should make your life simpler as you won't need to resort to named arguments for the most commonly used method parameters.

Of course, in order to mitigate the burden of adapting your code, the old method names & their parameter order will still be included for several months, marked as [Obsolete] and routing to the new methods.
Our documentation page for migrating to v22 will also include tips to help you port existing code to the new methods.

As much as I hated all the breaking changes that kept happening with this library prior to v21, I will make sure this kind of major breaking change stays a one-time thing and won't happen anymore.

— Your friend in time, Wizou

TelegramBots - News

06 Sep, 16:30


Telegram.Bot v21.11.0 is available!

What's new:
- Support for Bot API 7.10
- Emoji enums are now static constants (shouldn't need change in your code)
- Fix an issue if your OnMakingApiRequest was modifying HttpRequestMessage

Installation | Migration | Docs | Donate

TelegramBots - News

23 Aug, 20:53


Telegram.Bot v21.10.1 is available!

⚠️ Note:
We moved our main nuget feed to Azure DevOps, so it gets a more serious index.json URL. Please modify your Package sources when you can. (The previous nuget.voids.site is still usable for now, and we're still hoping to see the issue with nuget.org resolved in the future)

ℹ️ What's new:
- simplified payment price lists by accepting tuples for LabeledPrice
- both methods AnswerPreCheckoutQueryAsync are merged into one (no change should be needed in your code)
- added method AuthHelpers.ParseValidateData to authenticate Telegram Data coming from Mini-Apps & Login Widget web requests (.NET 6+)

New documentation:
📖 Guide for Payments API & Telegram Stars, including a full working example at the end
🌐 A full Mini-App example project, based on Razor template website, and even including a clone of @DurgerKingBot and WebAppDemo.

Installation | Migration | Docs | Donate

TelegramBots - News

14 Aug, 12:53


Telegram.Bot v21.10.0 is available!

What's new:
- Support for Bot API 7.9
- Cleaning of default HttpClient unused ports (.NET 6+)

Installation | Migration | Docs | Donate

TelegramBots - News

03 Aug, 15:04


Telegram.Bot v5839.17.0 v21.9.0 is available!

Automatic retrying API calls in case of "Too Many Requests": 🎉
- If Telegram servers fail on your API call with this error and ask you to to retry in less than 60 seconds, TelegramBotClient will now automatically wait for the requested delay and retry sending the same request up to 3 times.
- This is configurable using Options on the constructor:
using var cts = new CancellationTokenSource();
var options = new TelegramBotClientOptions(token) { RetryThreshold = 120, RetryCount = 2 };
var bot = new TelegramBotClient(options, cancellationToken: cts.Token);

- To disable this (and keep the same behavior as previous versions), use RetryThreshold = 0

Installation | Migration | Docs | Donate

TelegramBots - News

02 Aug, 14:22


📖 New documentation pages were added recently:

- Dealing with chats
- Forward, Copy or Delete messages
- Working with Updates & Messages
- Telegram Mini Apps
- Business Bot Features

A few other pages were updated too.

TelegramBots - News

31 Jul, 17:25


Telegram.Bot v21.8.0 is available!

What's new:
- Support for Bot API 7.8

Installation | Migration | Docs | Donate

TelegramBots - News

17 Jul, 12:48


Telegram.Bot v21.7.1 is available!

Simplified polling with events:
Instead of StartReceiving/ReceiveAsync system, you can now simply set 2 or 3 events on the botClient:
bot.OnMessage += ... to receive Message updates
bot.OnUpdate += ... to receive other updates (or all updates if you don't set OnMessage)
bot.OnError += ... to handle errors/exceptions during polling or your handlers

Note: 2nd argument to OnMessage event specifies which kind of update it was (edited, channel or business message?)

When you assign those events, polling starts automatically, you don't have anything to do.
Polling will stop when you remove (-=) your events, or when you cancel the global cancellation token

You can also use await bot.DropPendingUpdatesAsync() before setting those events to ignore past updates.
The Console example project has been updated to demonstrate these events.

Installation | Migration | Docs | Donate

TelegramBots - News

11 Jul, 12:42


Telegram.Bot v21.6.2 is available!

What's new:
- Support for Bot API 7.7
- Updated STJ package for prevent a vulnerability
- Support replyParameters: with a Message from another chat

Installation | Migration | Docs

TelegramBots - News

10 Jul, 18:07


Telegram.Bot v21.5 is available!

New helpers/extensions to simplify your code:
- When replying to a message, you can now simply pass a Message for replyParameters: rather than a Message.MessageId
- Update.AllTypes is a constant array containing all UpdateTypes. You can pass it for the allowedUpdates: parameter (GetUpdatesAsync/SetWebhookAsync)
- Message has now 2 extensions methods: .ToHtml() and .ToMarkdown() to convert the message text/caption and their entities into a simple Html or Markdown string.
- You can also use methods Markdown.Escape() and HtmlText.Escape() to sanitize reserved characters from strings
- Reply/Inline Keyboard Markup now have construction methods to simplify building keyboards dynamically:
var replyMarkup = new InlineKeyboardMarkup()
.AddButton(InlineKeyboardButton.WithUrl("Link to Repository", "https://github.com/TelegramBots/Telegram.Bot"))
.AddNewRow().AddButton("callback").AddButton("caption", "data")
.AddNewRow("with", "three", "buttons")
.AddNewRow().AddButtons("A", "B", InlineKeyboardButton.WithSwitchInlineQueryCurrentChat("switch"));

- Same for ReplyKeyboardMarkup (and you can use new ReplyKeyboardMarkup(true) to resize keyboard)

Installation
| Migration | Docs

TelegramBots - News

01 Jul, 21:34


Telegram.Bot v21.4 is available!

What's new:
- Support for Bot API 7.6 🔥

Installation | Migration | Docs

TelegramBots - News

30 Jun, 13:02


Examples projects have also been updated with 2 new projects:

- a much simpler Console project (which supports basic command handling)

- a very simple Webhook project with Minimal APIs (ASP․NET Core)

see also our new webhook documentation page (has some troubleshooting)

TelegramBots - News

28 Jun, 15:37


Telegram.Bot v21.2 is available!

What's new:
- Global cancellation token (pass it on constructor so you don't have to pass it on every method call)
- use services.ConfigureTelegramBotMvc() to configure ASP․NET MVC apps
(useful for mixing controller with Telegram.Bot specific JSON settings and your other existing JSON controllers/actions)

Installation | Migration | Docs

TelegramBots - News

23 Jun, 12:21


Telegram.Bot v21.1 is available!

What's new:
- Support for Bot API 7.5 🆕
- Updated Webhook documentation

Installation | Migration | Docs

TelegramBots - News

15 Jun, 18:09


Stable v20 has been released with support of up to Bot API 7.4 and is fully migrated to System.Text.Json. Since the problem with nuget.org is still not solved the release is published to two feeds:

- https://nuget.pkg.github.com/TelegramBots/index.json
- https://nuget.voids.site/v3/index.json

For webhook users, you can remove Microsoft.AspNetCore.Mvc.NewtonsoftJson package from your projects, but you'll need to configure built-in JSON serializer.

If you use controllers you need to configure them after the call to AddControllers() or similar ones like that:


using Telegram.Bot.Serialization;

// ...

services.AddControllers()
.AddJsonOptions(options => JsonSerializerOptionsProvider.Configure(options.JsonSerializerOptions));


If you use minimal apis you need to configure a separate type Microsoft.AspNetCore.Http.Json.JsonOptions like so:


using Telegram.Bot.Serialization;
using Microsoft.AspNetCore.Http.Json;

var builder = WebApplication.CreateBuilder();

builder.Services.Configure<JsonOptions>(options =>
{
JsonSerializerOptionsProvider.Configure(options.SerializerOptions);
});

TelegramBots - News

11 Apr, 22:09


⚠️ Latest versions of our library are not yet available on Nuget․org due to false-positive malware detection. We are working with Nuget/ESET teams to resolve this issue.

In the mean time, it's available on our special nuget feed: https://nuget.voids.site/v3/index.json

To use this feed, you need to configure the Package Source in Visual Studio's Nuget Packet Manager
(see this guide for how to proceed),
or add a nuget.config file to your project with the following content:

<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="TelegramBots feed" value="https://nuget.voids.site/v3/index.json" />
</packageSources>
</configuration>

TelegramBots - News

31 Oct, 15:13


💃 v20 alpha 1 is out with support for Bot API 6.8 and 6.9

https://www.nuget.org/packages/Telegram.Bot/20.0.0-alpha.1