Skip to content

Commit

Permalink
Merge pull request #455 from BoShurik/video-note
Browse files Browse the repository at this point in the history
Message Video Note
  • Loading branch information
BoShurik authored Sep 29, 2023
2 parents d44a9d5 + 939b6d7 commit f3b8d0b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All Notable changes to `PHP Telegram Bot Api` will be documented in this file
- Add support for third party http clients (`psr/http-client` and `symfony/http-client`)
- Add support for local bot API server
- Add method `\TelegramBot\Api\BotApi::validateWebAppData` to validate `window.Telegram.WebApp.initData`
- Add `\TelegramBot\Api\Types\Message::$videoNote` field

## 2.5.0 - 2023-08-09

Expand Down
25 changes: 25 additions & 0 deletions src/Types/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Message extends BaseType implements TypeInterface
'photo' => ArrayOfPhotoSize::class,
'sticker' => Sticker::class,
'video' => Video::class,
'video_note' => VideoNote::class,
'voice' => Voice::class,
'caption' => true,
'contact' => Contact::class,
Expand Down Expand Up @@ -254,6 +255,13 @@ class Message extends BaseType implements TypeInterface
*/
protected $video;

/**
* Optional. Message is a video note, information about the video message
*
* @var \TelegramBot\Api\Types\VideoNote|null
*/
protected $videoNote;

/**
* Optional. Message is a voice message, information about the file
*
Expand Down Expand Up @@ -874,6 +882,23 @@ public function getVideo()
return $this->video;
}

/**
* @return VideoNote|null
*/
public function getVideoNote()
{
return $this->videoNote;
}

/**
* @param VideoNote|null $videoNote
* @return void
*/
public function setVideoNote($videoNote)
{
$this->videoNote = $videoNote;
}

/**
* @param Video $video
* @return void
Expand Down
3 changes: 3 additions & 0 deletions tests/Types/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static function getFullResponse()
],
'sticker' => StickerTest::getMinResponse(),
'video' => VideoTest::getMinResponse(),
'video_note' => VideoNoteTest::getMinResponse(),
'voice' => VoiceTest::getMinResponse(),
'caption' => 'caption',
'contact' => ContactTest::getMinResponse(),
Expand Down Expand Up @@ -125,6 +126,7 @@ protected function assertMinItem($item)
$this->assertNull($item->getPhoto());
$this->assertNull($item->getSticker());
$this->assertNull($item->getVideo());
$this->assertNull($item->getVideoNote());
$this->assertNull($item->getVoice());
$this->assertNull($item->getCaption());
$this->assertNull($item->getContact());
Expand Down Expand Up @@ -186,6 +188,7 @@ protected function assertFullItem($item)
$this->assertEquals([PhotoSizeTest::createMinInstance()], $item->getPhoto());
$this->assertEquals(StickerTest::createMinInstance(), $item->getSticker());
$this->assertEquals(VideoTest::createMinInstance(), $item->getVideo());
$this->assertEquals(VideoNoteTest::createMinInstance(), $item->getVideoNote());
$this->assertEquals(VoiceTest::createMinInstance(), $item->getVoice());
$this->assertEquals('caption', $item->getCaption());
$this->assertEquals(ContactTest::createMinInstance(), $item->getContact());
Expand Down

0 comments on commit f3b8d0b

Please sign in to comment.