- $req->req->addPostParameter('h', 'entry');
- $req->req->addPostParameter('content', $command->args['text']);
-
- $files = $command->options['files'];
- $fileList = [
- 'audio' => [],
- 'photo' => [],
- 'video' => [],
- ];
- foreach ($files as $filePath) {
- if (!file_exists($filePath)) {
- Log::err('File does not exist: ' . $filePath);
- exit(20);
- }
- $type = 'photo';
- $fileList[$type][] = $filePath;
- }
- foreach ($fileList as $type => $filePaths) {
- if (count($filePaths) == 1) {
- $req->addUpload($type, reset($filePaths));
- } else if (count($filePaths) > 0) {
- $req->addUpload($type, $filePaths);
- }
- }
+ $req->setType('entry');
+ $req->addProperty('content', $cmdRes->args['text']);
+ $this->handleGenericOptions($cmdRes, $req);