Add SetStickerMaskPosition method
This commit is contained in:
parent
3bfdb2491c
commit
c7196005ac
2 changed files with 56 additions and 0 deletions
|
@ -101,6 +101,7 @@
|
|||
use TgBotLib\Methods\SetMyName;
|
||||
use TgBotLib\Methods\SetMyShortDescription;
|
||||
use TgBotLib\Methods\SetStickerEmojiList;
|
||||
use TgBotLib\Methods\SetStickerMaskPosition;
|
||||
use TgBotLib\Methods\SetStickerPositionInSet;
|
||||
use TgBotLib\Methods\SetWebhook;
|
||||
use TgBotLib\Methods\StopMessageLiveLocation;
|
||||
|
@ -224,6 +225,7 @@
|
|||
case DELETE_STICKER_FROM_SET = 'deleteStickerFromSet';
|
||||
case REPLACE_STICKER_IN_SET = 'replaceStickerInSet';
|
||||
case SET_STICKER_EMOJI_LIST = 'setStickerEmojiList';
|
||||
case SET_STICKER_MASK_POSITION = 'setStickerMaskPosition';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -345,6 +347,7 @@
|
|||
self::DELETE_STICKER_FROM_SET => DeleteStickerFromSet::execute($bot, $parameters),
|
||||
self::REPLACE_STICKER_IN_SET => ReplaceStickerInSet::execute($bot, $parameters),
|
||||
self::SET_STICKER_EMOJI_LIST => SetStickerEmojiList::execute($bot, $parameters),
|
||||
self::SET_STICKER_MASK_POSITION => SetStickerMaskPosition::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
53
src/TgBotLib/Methods/SetStickerMaskPosition.php
Normal file
53
src/TgBotLib/Methods/SetStickerMaskPosition.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class SetStickerMaskPosition extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
if(isset($parameters['mask_position']))
|
||||
{
|
||||
if($parameters['mask_position'] instanceof ObjectTypeInterface)
|
||||
{
|
||||
$parameters['mask_position'] = json_encode($parameters['mask_position']->toArray());
|
||||
}
|
||||
|
||||
if(is_array($parameters['mask_position']))
|
||||
{
|
||||
$parameters['mask_position'] = json_encode($parameters['mask_position']);
|
||||
}
|
||||
}
|
||||
|
||||
return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_STICKER_MASK_POSITION->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'sticker'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'mask_position'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue