telebot v2.2 Release Notes

Release Date: 2020-05-22 // almost 4 years ago
  • ๐Ÿš€ For this release, aside from Bot API implementation, we've prepared many new useful features.

    ๐Ÿ”„ Changelog

    • Completed Webhook, Games, Stickers and Payments APIs
    • ๐Ÿ”€ Synchronous mode and serverless support (#219)
    • Keyboard constructors (#290)
    • Special ChatID recipient type (#263)

    Serverless

    ๐Ÿ“ฆ Now it's possible to use telebot together with serverless providers like AWS, Azure, etc... Thanks to one of the package's contributors, you can check out exhaustive example in examples/awslambdaechobot.

    ๐Ÿ”€ Synchronous mode was added for these purposes:

    pref := tb.Settings{ Token: "", Synchronous: true, }b, err := tb.NewBot(pref)// ...
    

    Keyboard constructors

    โšก๏ธ Use special helper functions and types to decrease boilerplate across the code. The new keyboards builder make theirs definition easier. Look into updated README Keyboards section for details.

    menu := &ReplyMarkup{ResizeReplyKeyboard: true}var ( // Reply buttons.btnHelp= menu.Text("โ„น Help") btnSettings = menu.Text("โš™ Settings") )menu.Reply( menu.Row(btnHelp), menu.Row(btnSettings), )b.Handle(&btnHelp, func(m \*tb.Message) {...})b.Handle(&btnSettings, func(m \*tb.Message) {...})
    

    ChatID type

    It was a bit confusing to work with specific chat IDs. You had to wrap integer into &tb.Chat{} every time you wanted to send a message. Imagine you have a config file with a bunch of defined group or channel IDs. Now you can use your int64 values directly with functions which accepts Recipient interface.

    type Config struct { AdminGroup tb.ChatID `yaml:"admin_group_id"`AdsChannel tb.ChatID `yaml:"ads_channel_id"`}b.Send(conf.AdminGroup, "message")b.Send(conf.AdsChannel, "message")
    

    ๐Ÿ›  Fixes

    • โž• Added OnAnimation endpoint
    • ๐Ÿ›  Fixed regular expression for errors handling
    • ๐Ÿšš Action fields were removed from Buttons
    • b.Forward() changed to take Editable instead of *Message

    What's next?

    ๐Ÿ‘ The one unimplemented Bot API section left for the future โ€“ is Telegram Passport. Despite this, it's fair to say that telebot has full Bot API 4.8 support now.

    Our next goal โ€“ Telebot V3. It's going to be a compound of the good things we have in V2, the best solutions inherent to Bot frameworks, and, finally, completely new features.