Most breaking changes in v18 come from new Bot API changes, such as:
- In Bot API 6.0
voice_chat*
related message properties were deprecated in favour ofvideo_chat*
with the same semantics and shape. - With introduction of video stickers in Bot API 5.7 we needed a way
to separate methods for different sticker types. So static .WEBP
*StickerSet*
methods and requests were given aStatic
prefix. - Removed
untilDate
parameter fromTelegramBotClientExtensions.BanChatSenderChatAsync
method andUntilDate
property fromBanChatSenderChatRequest
class. - As of the next update some users will be able to upload up to 4GB files, so we changed
FileBase.FileSize
type tolong?
. - A new way of configuring the client.
ApiRequestEventArgs
contains full request data.
Complete list of changes is available in CHANGELOG
Telegram renamed voice_chat_*
properties in the Message
class and with video_chat_*
onces so we replaced
corresponding MessageType
enum members with the new ones.
Following properties in Message
class and corresponding enum members in MessageType
enum were changed:
-VoiceChatScheduled
-VoiceChatStarted
-VoiceChatEnded
-VoiceChatParticipantsInvited
+VideoChatScheduled
+VideoChatStarted
+VideoChatEnded
+VideoChatParticipantsInvited
Also property CanManageVoiceChats
in ChatMemberAdministrator
and PromoteChatMemberRequest
classes was renamed to
CanManageVideoChats
.
With introduction of video stickers in Bot API 5.7 we needed a way
to separate methods for different sticker types. We already used Animated
and Video
suffix for methods related to animated
and video stickers so we decided to do the same for the static stickers:
- Classes
CreateNewStickerSetRequest
andAddStickerToSetRequest
were renamed toCreateNewStaticStickerSetRequest
andAddStaticStickerToSetRequest
. - Methods
CreateNewStickerSetAsync
andAddStickerToSetAsync
where renamed toCreateStaticNewStickerSetAsync
andAddStaticStickerToSetAsync
.
3. Removal of untilDate
parameter from BanChatSenderChatAsync
method and UntilDate
property from BanChatSenderChatRequest
class
The untilDate
parameter from TelegramBotClientExtensions.BanChatSenderChatAsync
method and UntilDate
property from BanChatSenderChatRequest
class were removed from the Bot API.
As of the next update some users will be able to upload up to 4GB files, so we changed FileBase.FileSize
type to long?
to accommodate this change.
Starting with this release client configuration parameters should be passed through TelegramBotClientOptions
class.
You need to create an instance of TelegramBotClientOptions
and pass it to the client:
using Telegram.Bot;
var options = new TelegramBotClientOptions(
token: "<token>"
// pass an optional baseUrl if you want to use a custom bot server
baseUrl: "https://custombotserverdomain.com",
// pass an optional flag `true` if you want to use test environment
useTestEnvironment = true
);
var client = new TelegramBotClient(options);
If you don't know about test environment you can read more about it in the official documentation.
If you don't need extra configuration options you can still use the constructor that accepts a token and an instance of HttpClient
:
var client = new TelegramBotClient("<token>");
The latest biggest change which is not a breaking one, but nevertheless worth a note: deprecation of
Telegram.Bot.Extensions.Polling
package.
All the functionality from the package was merged into the core library under namespace Telegram.Bot.Polling
.
Name of the method HandleErrorAsync
in IUpdateHandler
interface was quite confusing from the beginning since a lot
of people assumed they can handle all errors in it, but in reality it's used only for handling errors during polling.
We decided to give it a more appropriate name: HandlePollingErrorAsync
.