Sha256: d25ce20612354fc79e37c3a28dddd96c24d7123b245f0c5802e39b22c12b5256

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

module Telegram
  module Bot
    module Types
      class Message < Base
        attr_accessor :chat

        attribute :message_id, Integer
        attribute :from, User
        attribute :date, Integer
        attribute :forward_from, User
        attribute :forward_date, Integer
        attribute :reply_to_message, Message
        attribute :text, String
        attribute :audio, Audio
        attribute :document, Document
        attribute :photo, Array[PhotoSize]
        attribute :sticker, Sticker
        attribute :video, Video
        attribute :contact, Contact
        attribute :location, Location
        attribute :new_chat_participant, User
        attribute :left_chat_participant, User
        attribute :new_chat_title, String
        attribute :new_chat_photo, Array[PhotoSize]
        attribute :delete_chat_photo, Boolean
        attribute :group_chat_created, Boolean

        def chat=(value)
          @chat =
          if value.key?('first_name')
            User.new(value)
          elsif value.key?('title')
            GroupChat.new(value)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
telegram-bot-ruby-0.3.0 lib/telegram/bot/types/message.rb
telegram-bot-ruby-0.2.6 lib/telegram/bot/types/message.rb
telegram-bot-ruby-0.2.5 lib/telegram/bot/types/message.rb