From 30ff05a1d63fb81d4004f4626a2a8e3e4738be95 Mon Sep 17 00:00:00 2001 From: greenplugin Date: Sat, 6 Jun 2020 00:31:21 +0300 Subject: [PATCH 1/3] #35: test updated --- tests/Method/SendDiceMethodTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Method/SendDiceMethodTest.php b/tests/Method/SendDiceMethodTest.php index d516b6e..742164f 100644 --- a/tests/Method/SendDiceMethodTest.php +++ b/tests/Method/SendDiceMethodTest.php @@ -52,6 +52,17 @@ public function dataProvider(): array ] ), ], + [ + $this->getApi(SendDiceMethod::EMOJI_BASKETBALL), + SendDiceMethod::createWithBasketball( + 'chat_id', + [ + 'disableNotification' => true, + 'replyToMessageId' => 1, + 'replyMarkup' => $this->buildInlineMarkupObject(), + ] + ), + ], ]; } From 46efc859db09d0c74ffecff3df677a6d3b9af345 Mon Sep 17 00:00:00 2001 From: greenplugin Date: Sat, 6 Jun 2020 00:33:59 +0300 Subject: [PATCH 2/3] #35: update changes implemented --- src/Method/SendDiceMethod.php | 14 ++++++++++++++ .../InlineQueryResult/InlineQueryResultGifType.php | 9 +-------- .../InlineQueryResultMpeg4GifType.php | 9 +-------- src/Type/MessageType.php | 7 +++++++ 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/Method/SendDiceMethod.php b/src/Method/SendDiceMethod.php index 2c73e57..56b5653 100644 --- a/src/Method/SendDiceMethod.php +++ b/src/Method/SendDiceMethod.php @@ -27,6 +27,7 @@ class SendDiceMethod implements SendMethodAliasInterface public const EMOJI_DICE = '🎲'; public const EMOJI_DARTS = '🎯'; + public const EMOJI_BASKETBALL = '🏀'; /** * 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 return $instance; } + + /** + * @param $chatId + * + * @throws BadArgumentException + */ + public static function createWithBasketball($chatId, array $data = null): SendDiceMethod + { + $instance = static::create($chatId, $data); + $instance->emoji = self::EMOJI_BASKETBALL; + + return $instance; + } } diff --git a/src/Type/InlineQueryResult/InlineQueryResultGifType.php b/src/Type/InlineQueryResult/InlineQueryResultGifType.php index e204820..5b91cdb 100644 --- a/src/Type/InlineQueryResult/InlineQueryResultGifType.php +++ b/src/Type/InlineQueryResult/InlineQueryResultGifType.php @@ -46,7 +46,7 @@ class InlineQueryResultGifType extends InlineQueryResultType implements HasParse public $gifDuration; /** - * URL of the static thumbnail for the result (jpeg or gif). + * URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result. * * @var string */ @@ -82,14 +82,7 @@ class InlineQueryResultGifType extends InlineQueryResultType implements HasParse public $inputMessageContent; /** - * @param string $id - * @param string $gifUrl - * @param string $thumbUrl - * @param array|null $data - * * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException - * - * @return InlineQueryResultGifType */ public static function create( string $id, diff --git a/src/Type/InlineQueryResult/InlineQueryResultMpeg4GifType.php b/src/Type/InlineQueryResult/InlineQueryResultMpeg4GifType.php index ffc5b30..4da6e15 100644 --- a/src/Type/InlineQueryResult/InlineQueryResultMpeg4GifType.php +++ b/src/Type/InlineQueryResult/InlineQueryResultMpeg4GifType.php @@ -46,7 +46,7 @@ class InlineQueryResultMpeg4GifType extends InlineQueryResultType implements Has public $mpeg4Duration; /** - * URL of the static thumbnail (jpeg or gif) for the result. + * URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result. * * @var string */ @@ -82,14 +82,7 @@ class InlineQueryResultMpeg4GifType extends InlineQueryResultType implements Has public $inputMessageContent; /** - * @param string $id - * @param string $mpeg4Url - * @param string $thumbUrl - * @param array|null $data - * * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException - * - * @return InlineQueryResultMpeg4GifType */ public static function create( string $id, diff --git a/src/Type/MessageType.php b/src/Type/MessageType.php index 1373604..3a57d45 100644 --- a/src/Type/MessageType.php +++ b/src/Type/MessageType.php @@ -92,6 +92,13 @@ class MessageType implements HasParseModeVariableInterface */ public $replyToMessage; + /** + * Optional. Bot through which the message was sent. + * + * @var UserType|null + */ + public $viaBot; + /** * Optional. Date the message was last edited in \DateTimeImmutable. * From 56de709fa67f875b99a85c845ba2cfd20201eaf6 Mon Sep 17 00:00:00 2001 From: greenplugin Date: Sat, 6 Jun 2020 00:41:34 +0300 Subject: [PATCH 3/3] #35: added changelog and updated readme --- CHANGELOG.md | 15 +++++++++++++++ README.md | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd65f24..3998d19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,21 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip - Nothing ---> +## 1.6.0 - 2020-06-06 + +#### June 4, 2020 +#### Bot API 4.9 + +### Added +- Added the new field `viaBot` to the `MessageType` class. +You can now know which bot was used to send a message. +- Supported video thumbnails for inline GIF and MPEG4 animations (Updated comments in classes). +- Supported the new basketball animation for the random dice. +Choose between different animations (dice, darts, basketball) +by specifying the emoji parameter in the `SendDiceMethod`. +Added to the class new factory method `SendDiceMethod::createWithBasketball` +and new constant `SendDiceMethod::EMOJI_BASKETBALL`. + ## 1.5.1 - 2020-05-28 ### Fixed diff --git a/README.md b/README.md index a35c5f4..13963ee 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ [![Duplicated Lines (%)][sonar-duplicated-lines-icon]][sonar-path] [![Security Rating][sonar-security-rating-icon]][sonar-path] -#### Supported Telegram Bot API v4.8 (April 24, 2020) +#### Supported Telegram Bot API v4.9 (June 4, 2020) ## Installation @@ -146,7 +146,7 @@ If you discover any security related issues, please email wformps@gmail.com inst The MIT License (MIT). Please see [License File](LICENSE.md) for more information. [ico-php-v]: https://img.shields.io/travis/php-v/tg-bot-api/bot-api-base.svg?style=flat-square -[ico-bot-api]: https://img.shields.io/badge/Bot%20API-4.8-blue.svg?style=flat-square +[ico-bot-api]: https://img.shields.io/badge/Bot%20API-4.9-blue.svg?style=flat-square [ico-version]: https://img.shields.io/packagist/v/tg-bot-api/bot-api-base.svg?style=flat-square [ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square [ico-travis]: https://img.shields.io/travis/tg-bot-api/bot-api-base/master.svg?style=flat-square