Бот выдаёт ошибку что ему не достаточно прав, хотя все возможные права у него есть.
public void sendNews(String id, String text) {
try {
File folder = new File("files" + File.separator + id);
List<String> attach = new ArrayList<>();
if (folder.exists()) {
GetWallUploadServerResponse serverResponse = getVkApiClient().photos().getWallUploadServer(getUserActor()).execute();
for (String s : getFiles(id)){
if (s.endsWith(".png") || s.endsWith(".jpg")) {
WallUploadResponse uploadResponse = getVkApiClient().upload().photoWall(String.valueOf(serverResponse.getUploadUrl()), new File("files" + File.separator + id + File.separator + s)).execute();
List<SaveWallPhotoResponse> now = getVkApiClient().photos().saveWallPhoto(getUserActor(), uploadResponse.getPhoto()).server(uploadResponse.getServer()).hash(uploadResponse.getHash()).caption(text).execute();
SaveWallPhotoResponse p = now.get(0);
String attachId = "photo"+p.getOwnerId()+"_"+p.getId();
attach.add(attachId);
System.out.println(attach.get(0));
} else{
//TODO: Normal saving response to save videos
SaveResponse sr = getVkApiClient().videos().save(getUserActor()).groupId(getGroupActor().getGroupId()).execute()
}
}
}
getVkApiClient().wall().post(getUserActor()).fromGroup(true).ownerId(-getGroupActor().getGroupId()).message(text).attachments(attach).execute();
} catch (ApiException e) {
e.printStackTrace();
} catch (ClientException e) {
e.printStackTrace();
}
}
Ошибка
com.vk.api.sdk.exceptions.ApiPermissionException: Permission to perform this action is denied (7): Permission to perform this action is denied: owner has not right for this action, can't add video