Answer the question
In order to leave comments, you need to log in
Why doesn't the bot have enough rights?
The bot gives an error that it does not have enough rights, although it has all possible rights.
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
Answer the question
In order to leave comments, you need to log in
since you are so sure that you are right, write in VK that they can’t cheat there, and you found a mistake with them. They kind of even pay to find bugs. Well, or rather, they will laugh at you
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question