Added SetStickerEmojiList method

This commit is contained in:
netkas 2024-11-15 15:00:48 -05:00
parent c18a5778bc
commit 3bfdb2491c
2 changed files with 46 additions and 0 deletions

View file

@ -100,6 +100,7 @@
use TgBotLib\Methods\SetMyDescription;
use TgBotLib\Methods\SetMyName;
use TgBotLib\Methods\SetMyShortDescription;
use TgBotLib\Methods\SetStickerEmojiList;
use TgBotLib\Methods\SetStickerPositionInSet;
use TgBotLib\Methods\SetWebhook;
use TgBotLib\Methods\StopMessageLiveLocation;
@ -222,6 +223,7 @@
case SET_STICKER_POSITION_IN_SET = 'setStickerPositionInSet';
case DELETE_STICKER_FROM_SET = 'deleteStickerFromSet';
case REPLACE_STICKER_IN_SET = 'replaceStickerInSet';
case SET_STICKER_EMOJI_LIST = 'setStickerEmojiList';
/**
* Executes a command on the provided bot with the given parameters.
@ -342,6 +344,7 @@
self::SET_STICKER_POSITION_IN_SET => SetStickerPositionInSet::execute($bot, $parameters),
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),
};
}
}

View file

@ -0,0 +1,43 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
class SetStickerEmojiList extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
if(isset($parameters['keywords']) && is_array($parameters['keywords']))
{
$parameters['keywords'] = json_encode($parameters['keywords']);
}
return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_STICKER_EMOJI_LIST->value, $parameters));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'sticker',
'emoji_list'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}