Add SetStickerPositionInSet method

This commit is contained in:
netkas 2024-11-15 00:32:38 -05:00
parent a4e36af33c
commit 9a7fb4194f
2 changed files with 41 additions and 0 deletions

View file

@ -98,6 +98,7 @@
use TgBotLib\Methods\SetMyDescription;
use TgBotLib\Methods\SetMyName;
use TgBotLib\Methods\SetMyShortDescription;
use TgBotLib\Methods\SetStickerPositionInSet;
use TgBotLib\Methods\SetWebhook;
use TgBotLib\Methods\StopMessageLiveLocation;
use TgBotLib\Methods\StopPoll;
@ -216,6 +217,7 @@
case UPLOAD_STICKER_FILE = 'uploadStickerFile';
case CREATE_NEW_STICKER_SET = 'createNewStickerSet';
case ADD_STICKER_TO_SET = 'addStickerToSet';
case SET_STICKER_POSITION_IN_SET = 'setStickerPositionInSet';
/**
* Executes a command on the provided bot with the given parameters.
@ -333,6 +335,7 @@
self::UPLOAD_STICKER_FILE => UploadStickerFile::execute($bot, $parameters),
self::CREATE_NEW_STICKER_SET => CreateNewStickerSet::execute($bot, $parameters),
self::ADD_STICKER_TO_SET => AddStickerToSet::execute($bot, $parameters),
self::SET_STICKER_POSITION_IN_SET => SetStickerPositionInSet::execute($bot, $parameters),
};
}
}

View file

@ -0,0 +1,38 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
class SetStickerPositionInSet extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_STICKER_POSITION_IN_SET->value, $parameters));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'sticker',
'position'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}