Class: Game

Inherits:
Object
  • Object
show all
Defined in:
lib/objects/game.rb

Overview

This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.

Instance Method Summary collapse

Constructor Details

#initialize(game) ⇒ Game

:nodoc:



11
12
13
# File 'lib/objects/game.rb', line 11

def initialize(game) # :nodoc:
  @game = game
end

Instance Method Details

#animationObject

Optional. Animation that will be displayed in the game message in chats. Upload via BotFather



33
34
35
# File 'lib/objects/game.rb', line 33

def animation
  @game.animation
end

#descriptionObject

Description of the game.



21
22
23
# File 'lib/objects/game.rb', line 21

def description
  @game.description
end

#photoObject

Photo that will be displayed in the game message in chats.



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/objects/game.rb', line 53

def photo
  poto = @game.photo
  if poto.empty?
    return false
  end

  ary = []
  poto.each do |p|
    ary << PhotoSize.new(p)
  end
  ary
end

#textObject

Optional. Brief description of the game or high scores included in the game message.



27
28
29
# File 'lib/objects/game.rb', line 27

def text
  @game.text
end

#text_entitiesObject

Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/objects/game.rb', line 39

def text_entities
  t_ent = @game.text_entities
  if t_ent.empty?
    return false
  end

  ary = []
  t_ent.each do |ent|
    ary << MessageEntity.new(ent)
  end
  ary
end

#titleObject

Title of the game.



16
17
18
# File 'lib/objects/game.rb', line 16

def title
  @game.title
end