You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
6
6
## [Unreleased]
7
7
### Added
8
8
-`ChatAction` class to simplify chat action selection.
9
+
- Telegram Games platform!
9
10
### Changed
10
11
-[:exclamation:][unreleased-bc-rename-constants] Rename and ensure no redefinition of constants: `BASE_PATH` -> `TB_BASE_PATH`, `BASE_COMMANDS_PATH` -> `TB_BASE_COMMANDS_PATH`.
Copy file name to clipboardExpand all lines: src/Entities/CallbackQuery.php
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@
22
22
* @method Message getMessage() Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old
23
23
* @method string getInlineMessageId() Optional. Identifier of the message sent via the bot in inline mode, that originated the query
24
24
* @method string getData() Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field
25
+
* @method string getGameShortName() Optional. Short name of a Game to be returned, serves as the unique identifier for the game
* For the full copyright and license information, please view the LICENSE
8
+
* file that was distributed with this source code.
9
+
*/
10
+
11
+
namespaceLongman\TelegramBot\Entities\Games;
12
+
13
+
useLongman\TelegramBot\Entities\Entity;
14
+
15
+
/**
16
+
* Class Animation
17
+
*
18
+
* You can provide an animation for your game so that it looks stylish in chats (check out Lumberjack for an example). This object represents an animation file to be displayed in the message containing a game.
* For the full copyright and license information, please view the LICENSE
8
+
* file that was distributed with this source code.
9
+
*/
10
+
11
+
namespaceLongman\TelegramBot\Entities\Games;
12
+
13
+
useLongman\TelegramBot\Entities\Entity;
14
+
useLongman\TelegramBot\Entities\MessageEntity;
15
+
16
+
/**
17
+
* Class Game
18
+
*
19
+
* This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
20
+
*
21
+
* @link https://core.telegram.org/bots/api#game
22
+
*
23
+
* @method string getTitle() Title of the game
24
+
* @method string getDescription() Description of the game
25
+
* @method string getText() Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
26
+
* @method Animation getAnimation() Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
27
+
**/
28
+
class Game extends Entity
29
+
{
30
+
/**
31
+
* {@inheritdoc}
32
+
*/
33
+
protectedfunctionsubEntities()
34
+
{
35
+
return [
36
+
'photo' => PhotoSize::class,
37
+
'text_entities' => MessageEntity::class,
38
+
'animation' => Animation::class,
39
+
];
40
+
}
41
+
42
+
/**
43
+
* Photo that will be displayed in the game message in chats.
44
+
*
45
+
* This method overrides the default getPhoto method
* @method string getText() Label text on the button
21
-
* @method string getUrl() Optional. HTTP url to be opened when button is pressed
22
-
* @method string getCallbackData() Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
23
-
* @method string getSwitchInlineQuery() Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.
24
-
* @method string getSwitchInlineQueryCurrentChat() Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted.
25
-
* @method bool getPay() Optional. Specify True, to send a Pay button.
21
+
* @method string getText() Label text on the button
22
+
* @method string getUrl() Optional. HTTP url to be opened when button is pressed
23
+
* @method string getCallbackData() Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
24
+
* @method string getSwitchInlineQuery() Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.
25
+
* @method string getSwitchInlineQueryCurrentChat() Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted.
26
+
* @method CallbackGame getCallbackGame() Optional. Description of the game that will be launched when the user presses the button.
27
+
* @method bool getPay() Optional. Specify True, to send a Pay button.
26
28
*
27
29
* @method $this setText(string $text) Label text on the button
28
30
* @method $this setUrl(string $url) Optional. HTTP url to be opened when button is pressed
29
31
* @method $this setCallbackData(string $callback_data) Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
30
32
* @method $this setSwitchInlineQuery(string $switch_inline_query) Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.
31
33
* @method $this setSwitchInlineQueryCurrentChat(string $switch_inline_query_current_chat) Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted.
34
+
* @method $this setCallbackGame(CallbackGame $callback_game) Optional. Description of the game that will be launched when the user presses the button.
32
35
* @method $this setPay(bool $pay) Optional. Specify True, to send a Pay button.
33
36
*/
34
37
class InlineKeyboardButton extends KeyboardButton
@@ -48,6 +51,7 @@ public static function couldBe($data)
thrownewTelegramException('You must use only one of these fields: url, callback_data, switch_inline_query, switch_inline_query_current_chat, pay!');
83
+
thrownewTelegramException('You must use only one of these fields: url, callback_data, switch_inline_query, switch_inline_query_current_chat, callback_game, pay!');
80
84
}
81
85
}
82
86
@@ -86,8 +90,8 @@ protected function validate()
86
90
publicfunction__call($method, $args)
87
91
{
88
92
// Only 1 of these can be set, so clear the others when setting a new one.
89
-
if (in_array($method, ['setUrl', 'setCallbackData', 'setSwitchInlineQuery', 'setSwitchInlineQueryCurrentChat', 'setPay'], true)) {
0 commit comments