Class: TelegramBot::Message

Inherits:
Struct
  • Object
show all
Includes:
AutoFromMethods
Defined in:
lib/telegram_bot/message.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AutoFromMethods

included

Instance Attribute Details

#audioObject

Returns the value of attribute audio

Returns:

  • (Object)

    the current value of audio



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def audio
  @audio
end

#chatObject

Returns the value of attribute chat

Returns:

  • (Object)

    the current value of chat



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def chat
  @chat
end

#contactObject

Returns the value of attribute contact

Returns:

  • (Object)

    the current value of contact



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def contact
  @contact
end

#dateObject

Returns the value of attribute date

Returns:

  • (Object)

    the current value of date



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def date
  @date
end

#delete_chat_photoObject

Returns the value of attribute delete_chat_photo

Returns:

  • (Object)

    the current value of delete_chat_photo



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def delete_chat_photo
  @delete_chat_photo
end

#documentObject

Returns the value of attribute document

Returns:

  • (Object)

    the current value of document



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def document
  @document
end

#forward_dateObject

Returns the value of attribute forward_date

Returns:

  • (Object)

    the current value of forward_date



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def forward_date
  @forward_date
end

#forward_fromObject

Returns the value of attribute forward_from

Returns:

  • (Object)

    the current value of forward_from



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def forward_from
  @forward_from
end

#fromObject

Returns the value of attribute from

Returns:

  • (Object)

    the current value of from



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def from
  @from
end

#group_chat_createdObject

Returns the value of attribute group_chat_created

Returns:

  • (Object)

    the current value of group_chat_created



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def group_chat_created
  @group_chat_created
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def id
  @id
end

#left_chat_participantObject

Returns the value of attribute left_chat_participant

Returns:

  • (Object)

    the current value of left_chat_participant



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def left_chat_participant
  @left_chat_participant
end

#locationObject

Returns the value of attribute location

Returns:

  • (Object)

    the current value of location



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def location
  @location
end

#new_chat_participantObject

Returns the value of attribute new_chat_participant

Returns:

  • (Object)

    the current value of new_chat_participant



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def new_chat_participant
  @new_chat_participant
end

#new_chat_photoObject

Returns the value of attribute new_chat_photo

Returns:

  • (Object)

    the current value of new_chat_photo



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def new_chat_photo
  @new_chat_photo
end

#new_chat_titleObject

Returns the value of attribute new_chat_title

Returns:

  • (Object)

    the current value of new_chat_title



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def new_chat_title
  @new_chat_title
end

#photoObject

Returns the value of attribute photo

Returns:

  • (Object)

    the current value of photo



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def photo
  @photo
end

#reply_to_messageObject

Returns the value of attribute reply_to_message

Returns:

  • (Object)

    the current value of reply_to_message



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def reply_to_message
  @reply_to_message
end

#stickerObject

Returns the value of attribute sticker

Returns:

  • (Object)

    the current value of sticker



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def sticker
  @sticker
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def text
  @text
end

#videoObject

Returns the value of attribute video

Returns:

  • (Object)

    the current value of video



4
5
6
# File 'lib/telegram_bot/message.rb', line 4

def video
  @video
end

Class Method Details

.extra_typesObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/telegram_bot/message.rb', line 35

def self.extra_types
  {
    from:                  TelegramBot::User,
    chat:                  TelegramBot::Chat,
    forward_from:          TelegramBot::User,
    forward_date:          TelegramBot::Date,
    reply_to_message:      TelegramBot::Message,
    audio:                 TelegramBot::Audio,
    document:              TelegramBot::Document,
    photo: [               TelegramBot::PhotoSize],
    sticker:               TelegramBot::Sticker,
    video:                 TelegramBot::Video,
    contact:               TelegramBot::Contact,
    location:              TelegramBot::Location,
    new_chat_participant:  TelegramBot::User,
    left_chat_participant: TelegramBot::User
  }
end

.hash_key_aliasesObject



29
30
31
32
33
# File 'lib/telegram_bot/message.rb', line 29

def self.hash_key_aliases
  {
    :id => :message_id,
  }
end

Instance Method Details

#is_forward?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/telegram_bot/message.rb', line 73

def is_forward?
  !!forward_from
end

#is_reply?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/telegram_bot/message.rb', line 77

def is_reply?
  !!reply_to_message
end

#typeObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/telegram_bot/message.rb', line 54

def type
  case
  when text                  then :text
  when photo                 then :photo
  when audio                 then :audio
  when document              then :document
  when sticker               then :sticker
  when video                 then :video
  when contact               then :contact
  when location              then :location
  when new_chat_participant  then :member_entered
  when left_chat_participant then :member_left
  when new_chat_title        then :chat_title_updatd
  when new_chat_photo        then :chat_photo_updated
  when delete_chat_photo     then :chat_photo_deleted
  when group_chat_created    then :group_chat_created
  end
end