Skip to content

Commit 831c125

Browse files
authored
Merge pull request #36 from tg-bot-api/feature/35-bot-api-4-9
Feature #35 bot api 4.9
2 parents 065c8eb + 56de709 commit 831c125

File tree

7 files changed

+51
-18
lines changed

7 files changed

+51
-18
lines changed

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
2323
- Nothing
2424
--->
2525

26+
## 1.6.0 - 2020-06-06
27+
28+
#### June 4, 2020
29+
#### Bot API 4.9
30+
31+
### Added
32+
- Added the new field `viaBot` to the `MessageType` class.
33+
You can now know which bot was used to send a message.
34+
- Supported video thumbnails for inline GIF and MPEG4 animations (Updated comments in classes).
35+
- Supported the new basketball animation for the random dice.
36+
Choose between different animations (dice, darts, basketball)
37+
by specifying the emoji parameter in the `SendDiceMethod`.
38+
Added to the class new factory method `SendDiceMethod::createWithBasketball`
39+
and new constant `SendDiceMethod::EMOJI_BASKETBALL`.
40+
2641
## 1.5.1 - 2020-05-28
2742

2843
### Fixed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
[![Duplicated Lines (%)][sonar-duplicated-lines-icon]][sonar-path]
1515
[![Security Rating][sonar-security-rating-icon]][sonar-path]
1616

17-
#### Supported Telegram Bot API v4.8 (April 24, 2020)
17+
#### Supported Telegram Bot API v4.9 (June 4, 2020)
1818

1919
## Installation
2020

@@ -146,7 +146,7 @@ If you discover any security related issues, please email [email protected] inst
146146
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
147147

148148
[ico-php-v]: https://img.shields.io/travis/php-v/tg-bot-api/bot-api-base.svg?style=flat-square
149-
[ico-bot-api]: https://img.shields.io/badge/Bot%20API-4.8-blue.svg?style=flat-square
149+
[ico-bot-api]: https://img.shields.io/badge/Bot%20API-4.9-blue.svg?style=flat-square
150150
[ico-version]: https://img.shields.io/packagist/v/tg-bot-api/bot-api-base.svg?style=flat-square
151151
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
152152
[ico-travis]: https://img.shields.io/travis/tg-bot-api/bot-api-base/master.svg?style=flat-square

src/Method/SendDiceMethod.php

+14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class SendDiceMethod implements SendMethodAliasInterface
2727

2828
public const EMOJI_DICE = '🎲';
2929
public const EMOJI_DARTS = '🎯';
30+
public const EMOJI_BASKETBALL = '🏀';
3031

3132
/**
3233
* Emoji on which the dice throw animation is based. Currently, must be one of “🎲” or “🎯”. Defauts to “🎲”.
@@ -77,4 +78,17 @@ public static function createWithDarts($chatId, array $data = null): SendDiceMet
7778

7879
return $instance;
7980
}
81+
82+
/**
83+
* @param $chatId
84+
*
85+
* @throws BadArgumentException
86+
*/
87+
public static function createWithBasketball($chatId, array $data = null): SendDiceMethod
88+
{
89+
$instance = static::create($chatId, $data);
90+
$instance->emoji = self::EMOJI_BASKETBALL;
91+
92+
return $instance;
93+
}
8094
}

src/Type/InlineQueryResult/InlineQueryResultGifType.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class InlineQueryResultGifType extends InlineQueryResultType implements HasParse
4646
public $gifDuration;
4747

4848
/**
49-
* URL of the static thumbnail for the result (jpeg or gif).
49+
* URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
5050
*
5151
* @var string
5252
*/
@@ -82,14 +82,7 @@ class InlineQueryResultGifType extends InlineQueryResultType implements HasParse
8282
public $inputMessageContent;
8383

8484
/**
85-
* @param string $id
86-
* @param string $gifUrl
87-
* @param string $thumbUrl
88-
* @param array|null $data
89-
*
9085
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
91-
*
92-
* @return InlineQueryResultGifType
9386
*/
9487
public static function create(
9588
string $id,

src/Type/InlineQueryResult/InlineQueryResultMpeg4GifType.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class InlineQueryResultMpeg4GifType extends InlineQueryResultType implements Has
4646
public $mpeg4Duration;
4747

4848
/**
49-
* URL of the static thumbnail (jpeg or gif) for the result.
49+
* URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
5050
*
5151
* @var string
5252
*/
@@ -82,14 +82,7 @@ class InlineQueryResultMpeg4GifType extends InlineQueryResultType implements Has
8282
public $inputMessageContent;
8383

8484
/**
85-
* @param string $id
86-
* @param string $mpeg4Url
87-
* @param string $thumbUrl
88-
* @param array|null $data
89-
*
9085
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
91-
*
92-
* @return InlineQueryResultMpeg4GifType
9386
*/
9487
public static function create(
9588
string $id,

src/Type/MessageType.php

+7
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ class MessageType implements HasParseModeVariableInterface
9292
*/
9393
public $replyToMessage;
9494

95+
/**
96+
* Optional. Bot through which the message was sent.
97+
*
98+
* @var UserType|null
99+
*/
100+
public $viaBot;
101+
95102
/**
96103
* Optional. Date the message was last edited in \DateTimeImmutable.
97104
*

tests/Method/SendDiceMethodTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ public function dataProvider(): array
5252
]
5353
),
5454
],
55+
[
56+
$this->getApi(SendDiceMethod::EMOJI_BASKETBALL),
57+
SendDiceMethod::createWithBasketball(
58+
'chat_id',
59+
[
60+
'disableNotification' => true,
61+
'replyToMessageId' => 1,
62+
'replyMarkup' => $this->buildInlineMarkupObject(),
63+
]
64+
),
65+
],
5566
];
5667
}
5768

0 commit comments

Comments
 (0)