Sha256: 5caf5e39eb22662f909bbaf9a7d58cd449ee15e038150a9c77a468993c02a23d

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

module Telegram
  module Bot
    module Types
      class Update < Base
        attribute :update_id, Types::Integer
        attribute? :message, Message
        attribute? :edited_message, Message
        attribute? :channel_post, Message
        attribute? :edited_channel_post, Message
        attribute? :business_connection, BusinessConnection
        attribute? :business_message, Message
        attribute? :edited_business_message, Message
        attribute? :deleted_business_messages, BusinessMessagesDeleted
        attribute? :message_reaction, MessageReactionUpdated
        attribute? :message_reaction_count, MessageReactionCountUpdated
        attribute? :inline_query, InlineQuery
        attribute? :chosen_inline_result, ChosenInlineResult
        attribute? :callback_query, CallbackQuery
        attribute? :shipping_query, ShippingQuery
        attribute? :pre_checkout_query, PreCheckoutQuery
        attribute? :purchased_paid_media, PaidMediaPurchased
        attribute? :poll, Poll
        attribute? :poll_answer, PollAnswer
        attribute? :my_chat_member, ChatMemberUpdated
        attribute? :chat_member, ChatMemberUpdated
        attribute? :chat_join_request, ChatJoinRequest
        attribute? :chat_boost, ChatBoostUpdated
        attribute? :removed_chat_boost, ChatBoostRemoved

        def current_message
          @current_message ||=
            Hash[*attributes.find { |k, v| k != :update_id && v }].values.first
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
telegram-bot-ruby-2.1.0 lib/telegram/bot/types/update.rb