From dd236c003423757102412491f135c8d5ac56c2cf Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sat, 15 Jan 2022 18:50:03 +0200 Subject: [PATCH] VKAPI: Add the ability to publish posts only with media --- VKAPI/Handlers/Wall.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/VKAPI/Handlers/Wall.php b/VKAPI/Handlers/Wall.php index cb8a1ca2..530c8aa4 100644 --- a/VKAPI/Handlers/Wall.php +++ b/VKAPI/Handlers/Wall.php @@ -110,7 +110,7 @@ final class Wall extends VKAPIRequestHandler ]; } - function post(string $owner_id, string $message, int $from_group = 0, int $signed = 0): object + function post(string $owner_id, string $message = "", int $from_group = 0, int $signed = 0): object { $this->requireUser(); @@ -167,6 +167,9 @@ final class Wall extends VKAPIRequestHandler $this->fail(-156, "The media file is corrupted or too large "); } + if(empty($message) && !$photo && !$video) + $this->fail(100, "Required parameter 'message' missing."); + try { $post = new Post; $post->setOwner($this->getUser()->getId());