VKAPI: Add the ability to publish posts only with media

This commit is contained in:
Maxim Leshchenko 2022-01-15 18:50:03 +02:00
parent a81e9ac704
commit dd236c0034
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE

View file

@ -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(); $this->requireUser();
@ -167,6 +167,9 @@ final class Wall extends VKAPIRequestHandler
$this->fail(-156, "The media file is corrupted or too large "); $this->fail(-156, "The media file is corrupted or too large ");
} }
if(empty($message) && !$photo && !$video)
$this->fail(100, "Required parameter 'message' missing.");
try { try {
$post = new Post; $post = new Post;
$post->setOwner($this->getUser()->getId()); $post->setOwner($this->getUser()->getId());