Привел к новой версии SDK VK 1.0.2
This commit is contained in:
parent
0bab5fa93e
commit
aab0f6b075
@ -32,9 +32,7 @@ public class VkApi {
|
||||
try {
|
||||
List<UserXtrCounters> temp = vk.users().get(actor).userIds(String.valueOf(id)).execute();
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject object = parser.parse(temp.get(0).toString().substring(15)).getAsJsonObject();
|
||||
object.add("last_name", object.get("lastName"));
|
||||
object.add("first_name", object.get("firstName"));
|
||||
JsonObject object = parser.parse(temp.get(0).toString()).getAsJsonObject();
|
||||
userMin = gson.fromJson(object, UserMin.class);
|
||||
} catch (ApiException | ClientException e) {
|
||||
log.error(e);
|
||||
|
@ -11,6 +11,8 @@ import org.sadtech.bot.core.sender.Sent;
|
||||
import org.sadtech.vkbot.core.VkConnect;
|
||||
import org.sadtech.vkbot.core.VkInsertData;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class MailSenderVk implements Sent {
|
||||
|
||||
private static final Logger log = Logger.getLogger(MailSenderVk.class);
|
||||
@ -28,7 +30,7 @@ public class MailSenderVk implements Sent {
|
||||
|
||||
@Override
|
||||
public void send(Integer idPerson, String message) {
|
||||
sendMessage(vkApiClient.messages().send(groupActor).peerId(idPerson).message(message));
|
||||
sendMessage(vkApiClient.messages().send(groupActor).peerId(idPerson).message(message).randomId(ThreadLocalRandom.current().nextInt(0, Integer.MAX_VALUE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -39,7 +41,7 @@ public class MailSenderVk implements Sent {
|
||||
|
||||
//FIXME: Пофиксить клавиатуры
|
||||
private MessagesSendQuery createMessage(BoxAnswer boxAnswer, Integer peerId) {
|
||||
MessagesSendQuery messages = vkApiClient.messages().send(groupActor).peerId(peerId).message(vkInsertData.insertWords(boxAnswer.getMessage(), peerId));
|
||||
MessagesSendQuery messages = vkApiClient.messages().send(groupActor).peerId(peerId).message(vkInsertData.insertWords(boxAnswer.getMessage(), peerId)).randomId(ThreadLocalRandom.current().nextInt(0, Integer.MAX_VALUE));
|
||||
if (boxAnswer.getKeyboard() != null) {
|
||||
// messages.keyboard(boxAnswer.getKeyboard());
|
||||
} else {
|
||||
@ -65,4 +67,8 @@ public class MailSenderVk implements Sent {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Integer reandomId() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user