Commit 4e284cd8 authored by Armando Lüscher's avatar Armando Lüscher Committed by GitHub

Merge pull request #604 from noplanman/bot_api_3.2

Bot API 3.2
parents 309421d7 e6ffc037
...@@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ...@@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
## [Unreleased] ## [Unreleased]
### Added ### Added
- New entities, methods, update types and inline keyboard button for Payments (Bot API 3.0). - New entities, methods, update types and inline keyboard button for Payments (Bot API 3.0).
- Add new methods, fields and objects for working with stickers (Bot API 3.2).
### Changed ### Changed
- [:exclamation:][unreleased-correct-printerror] Corrected `ServerResponse->printError` method to print by default and return by setting `$return` parameter. - [:exclamation:][unreleased-correct-printerror] Corrected `ServerResponse->printError` method to print by default and return by setting `$return` parameter.
- Ensure command names are handled as lower case. - Ensure command names are handled as lower case.
......
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
/**
* Class MaskPosition
*
* @link https://core.telegram.org/bots/api#maskposition
*
* @method string getPoint() The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
* @method float getXShift() Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
* @method float getYShift() Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
* @method float getScale() Mask scaling coefficient. For example, 2.0 means double size.
*/
class MaskPosition extends Entity
{
}
...@@ -15,12 +15,14 @@ namespace Longman\TelegramBot\Entities; ...@@ -15,12 +15,14 @@ namespace Longman\TelegramBot\Entities;
* *
* @link https://core.telegram.org/bots/api#sticker * @link https://core.telegram.org/bots/api#sticker
* *
* @method string getFileId() Unique identifier for this file * @method string getFileId() Unique identifier for this file
* @method int getWidth() Sticker width * @method int getWidth() Sticker width
* @method int getHeight() Sticker height * @method int getHeight() Sticker height
* @method PhotoSize getThumb() Optional. Sticker thumbnail in .webp or .jpg format * @method PhotoSize getThumb() Optional. Sticker thumbnail in .webp or .jpg format
* @method string getEmoji() Optional. Emoji associated with the sticker * @method string getEmoji() Optional. Emoji associated with the sticker
* @method int getFileSize() Optional. File size * @method string getSetName() Optional. Name of the sticker set to which the sticker belongs
* @method MaskPosition getMaskPosition() Optional. For mask stickers, the position where the mask should be placed
* @method int getFileSize() Optional. File size
*/ */
class Sticker extends Entity class Sticker extends Entity
{ {
...@@ -30,7 +32,8 @@ class Sticker extends Entity ...@@ -30,7 +32,8 @@ class Sticker extends Entity
protected function subEntities() protected function subEntities()
{ {
return [ return [
'thumb' => PhotoSize::class, 'thumb' => PhotoSize::class,
'mask_position' => MaskPosition::class,
]; ];
} }
} }
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
/**
* Class StickerSet
*
* @link https://core.telegram.org/bots/api#stickerset
*
* @method string getName() Sticker set name
* @method string getTitle() Sticker set title
* @method bool getContainsMasks() True, if the sticker set contains masks
*/
class StickerSet extends Entity
{
/**
* List of all set stickers
*
* This method overrides the default getStickers method and returns a nice array
*
* @return Sticker[]
*/
public function getStickers()
{
$all_stickers = [];
if ($these_stickers = $this->getProperty('stickers')) {
foreach ($these_stickers as $stickers) {
$new_stickers = [];
foreach ($stickers as $sticker) {
$new_stickers[] = new Sticker($sticker);
}
$all_stickers[] = $new_stickers;
}
}
return $all_stickers;
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment