-
Brand new formatting helpers! No more awkward escaping.
import { fmt, bold, italics, mention } from "telegraf/format"; ctx.reply(fmt` Ground control to ${mention("Major Tom", 10000000)} ${bold`Lock your Soyuz hatch`} and ${italic`put your helmet on`} — ${link("David Bowie", "https://en.wikipedia.org/wiki/David_Bowie")} `);
This also just works with captions!
ctx.replyWithPhoto( file.id, { caption: fmt`${bold`File name:`} ${file.name}` }, );
-
Added Input helpers to create the InputFile object.
import { Telegraf, Input } from "telegraf"; const bot = new Telegraf(token); bot.telegram.sendVideo(chatId, Input.fromLocalFile("../assets/cats.mp4")); bot.telegram.sendDocument(chatId, Input.fromBuffer(buf)); bot.command("cat", ctx => { ctx.sendPhoto(Input.fromURL("https://funny-cats.example/cats.jpg")) });
This helps clear the confusion many users have about InputFile.
-
Deprecated
ctx.replyWithMarkdown
; prefer MarkdownV2 as Telegram recommends. -
Deprecated
ctx.replyWithChatAction
; use identical methodctx.sendChatAction
instead. -
bot.launch()
's webhook options now acceptscertificate
for self-signed certs. -
Fix bot crashes if
updateHandler
throws (#1709)