Simple Telegram bot library for Crystal
The core functionality of Tourmaline is now auto generated from the official Bot API documentation. This means that Tourmaline will always be up to date with the latest version of the Bot API.
No bug fixes reported in this diff.
Full Changelog: https://github.com/protoncr/tourmaline/compare/v0.28.0...v0.29.0-beta.1
Full Changelog: https://github.com/protoncr/tourmaline/compare/v0.27.0...v0.28.0
is_
prefixed properties in models have been replaced with ?
getters. For instance, is_anonymous
is now anonymous?
.Client#default_parse_mode
and Client#default_command_prefixes
have been made class properties instead of instance properties.priority
and group
properties on event handlers.extra/paginated_keyboard
no longer extends InlineKeyboardMarkup
.Client#send_paginated_keyboard
, Chat#send_paginated_keyboard
, Message#reply_with_paginated_keyboard
, and Message#respond_with_paginated_keyboard
. Requires import of extra/paginated_keyboard
.extra/routed_menu
.extra/stage
.Tourmaline::Client
.UpdateAction
s including ThreadMessage
, ForumTopicCreated
, ForumTopicClosed
, ForumTopicReopened
, VideoChatScheduled
, VideoChatStarted
, VideoChatEnded
, VideoChatParticipantsInvited
, and WebAppData
.Among other things this release adds official support for TDlight, a Bot API fork with more features and more transparent development. See the CHANGELOG for more details.
Ok so this release removes the filters added several releases back. I didn't like how filters forced people to think and they weren't very Crystally in function. The main issue with them was trying to allow a developer to receive information about the update being filtered. I tried to solve this using Update#context
, but it was majorly limited and pretty messy.
So handlers are back and better than ever! I had initially gotten rid of handlers because I couldn't figure out a way to handle them that wasn't messy. In the initial revision each handler was its own class, but the annotation logic for the handler was contained in the base EventHandler
class. This made it hard to figure out an easy way for people to add their own handlers without also being able to modify the method within EventHandlers::Annotator
that handled the annotation logic.
Well no more! EventHandler
is now a very simple abstract class that requires one method, call(update : Update)
. If a subclass includes a self.annotate
method that method will be called when the client is initialized. There are also several new handlers that didn't exist before, based on the filters they replaced, including CommandHandler
, HearsHandler
, CallbackQueryHandler
, ChosenInlineResultHandler
, InlineQueryHandler
, and the standard UpdateHandler
. I highly recommend checking out the API docs on each of them.
This update also brings RoutedMenu
for easy creation of menus using inline keyboards.