Improve VK photo-upload error message and token instructions

- Replace the misleading 'community token cannot upload photos' fallback warning with the actual VK error and a concrete checklist (photos right + token bound to the same group)
- Extend UI hint with troubleshooting note for the 'photos as links' symptom

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
zuevav
2026-04-30 15:53:14 +03:00
parent 83d507571e
commit 5d62158b1b
2 changed files with 7 additions and 1 deletions
+4 -1
View File
@@ -292,7 +292,10 @@ class VKAPI
try {
$result = $this->wallPost($numericGroupId, $messageWithPhotos, []);
$result['warning'] = 'Фото добавлены как ссылки. Community-токен не поддерживает загрузку фото - нужен пользовательский токен.';
$firstError = $uploadErrors[0] ?? 'неизвестная ошибка';
$result['warning'] = 'Фото добавлены как ссылки — VK отказал в загрузке (' . $firstError . '). '
. 'Проверьте, что ключ сообщества создан с правом «Фотографии» и принадлежит ИМЕННО той группе, в которую вы постите. '
. 'Если используете пользовательский токен — у него должны быть права wall, photos, groups.';
return $result;
} catch (Exception $e) {
throw new RuntimeException('Ошибка постинга: ' . $e->getMessage() . '. Также нет прав на загрузку фото.');