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