diff --git a/src/TgBotLib/Enums/Methods.php b/src/TgBotLib/Enums/Methods.php index 4d4323e..d9259e7 100644 --- a/src/TgBotLib/Enums/Methods.php +++ b/src/TgBotLib/Enums/Methods.php @@ -106,6 +106,7 @@ use TgBotLib\Methods\UnpinAllForumTopicMessages; use TgBotLib\Methods\UnpinAllGeneralForumTopicMessages; use TgBotLib\Methods\UnpinChatMessage; + use TgBotLib\Methods\UploadStickerFile; enum Methods : string { @@ -210,6 +211,7 @@ case SEND_STICKER = 'sendSticker'; case GET_STICKER_SET = 'getStickerSet'; case GET_CUSTOM_EMOJI_STICKERS = 'getCustomEmojiStickers'; + case UPLOAD_STICKER_FILE = 'uploadStickerFile'; /** * Executes a command on the provided bot with the given parameters. @@ -324,6 +326,7 @@ self::SEND_STICKER => SendSticker::execute($bot, $parameters), self::GET_STICKER_SET => GetStickerSet::execute($bot, $parameters), self::GET_CUSTOM_EMOJI_STICKERS => GetCustomEmojiStickers::execute($bot, $parameters), + self::UPLOAD_STICKER_FILE => UploadStickerFile::execute($bot, $parameters), }; } } diff --git a/src/TgBotLib/Methods/UploadStickerFile.php b/src/TgBotLib/Methods/UploadStickerFile.php new file mode 100644 index 0000000..d280e40 --- /dev/null +++ b/src/TgBotLib/Methods/UploadStickerFile.php @@ -0,0 +1,53 @@ +value, 'sticker', $sticker, array_diff_key($parameters, ['sticker' => null])); + return File::fromArray(self::executeCurl($curl)); + } + } + + return File::fromArray(self::executeCurl(self::buildPost($bot, Methods::UPLOAD_STICKER_FILE->value, $parameters))); + } + + /** + * @inheritDoc + */ + public static function getRequiredParameters(): ?array + { + return [ + 'user_id', + 'sticker', + 'sticker_format' + ]; + } + + /** + * @inheritDoc + */ + public static function getOptionalParameters(): ?array + { + return null; + } + } \ No newline at end of file