Sha256: 5d4cb77cfe32ecefe3c243592f41e3dd7c9cd3c4ea493427da43f3d94f37c2c0

Contents?: true

Size: 1.1 KB

Versions: 6

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?('username')
            User.new(value)
          elsif value.key?('title')
            GroupChat.new(value)
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
telegram-bot-ruby-0.2.4 lib/telegram/bot/types/message.rb
telegram-bot-ruby-0.2.3 lib/telegram/bot/types/message.rb
telegram-bot-ruby-0.2.2 lib/telegram/bot/types/message.rb
telegram-bot-ruby-0.2.1 lib/telegram/bot/types/message.rb
telegram-bot-ruby-0.2.0 lib/telegram/bot/types/message.rb
telegram-bot-ruby-0.1.0 lib/telegram/bot/types/message.rb