Closed smaximov closed 3 years ago
This PR adds support for pattern-matching Telegram types.
Some silly example:
update = Telegram::Bot::Api::Update.new(payload) include Telegram::Bot::Api::Types case update in Update(message: Message(text: text, from: User(id: telegram_id, is_bot: false))) bot.api.send_message(chat_id: telegram_id, text: text.reverse) in Update(message: Message(text: text, from: User(id: telegram_id, is_bot: true))) bot.api.send_message(chat_id: telegram_id, text: 'No bots allowed!') else # unsupported update type end
@smaximov looks good, thanks! Merged.
This PR adds support for pattern-matching Telegram types.
Some silly example: