1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Zanzara\Telegram\Type\Game; |
6
|
|
|
|
7
|
|
|
use Zanzara\Telegram\Type\File\Animation; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. |
11
|
|
|
* |
12
|
|
|
* More on https://core.telegram.org/bots/api#game |
13
|
|
|
*/ |
14
|
|
|
class Game |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Title of the game |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
private $title; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Description of the game |
26
|
|
|
* |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
private $description; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Photo that will be displayed in the game message in chats. |
33
|
|
|
* |
34
|
|
|
* @var \Zanzara\Telegram\Type\File\PhotoSize[] |
35
|
|
|
*/ |
36
|
|
|
private $photo; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to |
40
|
|
|
* include current high scores for the game when the bot calls setGameScore, or manually edited using |
41
|
|
|
* editMessageText. 0-4096 characters. |
42
|
|
|
* |
43
|
|
|
* @var string|null |
44
|
|
|
*/ |
45
|
|
|
private $text; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc. |
49
|
|
|
* |
50
|
|
|
* @var \Zanzara\Telegram\Type\MessageEntity[]|null |
51
|
|
|
*/ |
52
|
|
|
private $text_entities; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Optional. Animation that will be displayed in the game message in chats. Upload via BotFather |
56
|
|
|
* |
57
|
|
|
* @var Animation|null |
58
|
|
|
*/ |
59
|
|
|
private $animation; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return string |
63
|
|
|
*/ |
64
|
|
|
public function getTitle(): string |
65
|
|
|
{ |
66
|
|
|
return $this->title; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param string $title |
71
|
|
|
*/ |
72
|
|
|
public function setTitle(string $title): void |
73
|
|
|
{ |
74
|
|
|
$this->title = $title; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return string |
79
|
|
|
*/ |
80
|
|
|
public function getDescription(): string |
81
|
|
|
{ |
82
|
|
|
return $this->description; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @param string $description |
87
|
|
|
*/ |
88
|
|
|
public function setDescription(string $description): void |
89
|
|
|
{ |
90
|
|
|
$this->description = $description; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @return \Zanzara\Telegram\Type\File\PhotoSize[] |
95
|
|
|
*/ |
96
|
|
|
public function getPhoto(): array |
97
|
|
|
{ |
98
|
|
|
return $this->photo; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @param \Zanzara\Telegram\Type\File\PhotoSize[] $photo |
103
|
|
|
*/ |
104
|
|
|
public function setPhoto(array $photo): void |
105
|
|
|
{ |
106
|
|
|
$this->photo = $photo; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return string|null |
111
|
|
|
*/ |
112
|
|
|
public function getText(): ?string |
113
|
|
|
{ |
114
|
|
|
return $this->text; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param string|null $text |
119
|
|
|
*/ |
120
|
|
|
public function setText(?string $text): void |
121
|
|
|
{ |
122
|
|
|
$this->text = $text; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @return \Zanzara\Telegram\Type\MessageEntity[]|null |
127
|
|
|
*/ |
128
|
|
|
public function getTextEntities(): ?array |
129
|
|
|
{ |
130
|
|
|
return $this->text_entities; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @param \Zanzara\Telegram\Type\MessageEntity[]|null $text_entities |
135
|
|
|
*/ |
136
|
|
|
public function setTextEntities(?array $text_entities): void |
137
|
|
|
{ |
138
|
|
|
$this->text_entities = $text_entities; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @return Animation|null |
143
|
|
|
*/ |
144
|
|
|
public function getAnimation(): ?Animation |
145
|
|
|
{ |
146
|
|
|
return $this->animation; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @param Animation|null $animation |
151
|
|
|
*/ |
152
|
|
|
public function setAnimation(?Animation $animation): void |
153
|
|
|
{ |
154
|
|
|
$this->animation = $animation; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
} |