Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for longpool #265

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,17 +363,13 @@ vk.groups().setLongPollSettings(groupActor).enabled(true)
Override methods from CallbackApiLongPoll class for handling events and create needed constructors

```java
public class CallbackApiLongPollHandler extends CallbackApiLongPoll {
public CallbackApiLongPollHandler(VkApiClient client, UserActor actor, Integer groupId) {
super(client, actor, groupId);
}

public CallbackApiLongPollHandler(VkApiClient client, GroupActor actor) {
super(client, actor);
public class CallbackApiLongPollHandler extends GroupLongPollApi {
public CallbackApiLongPollHandler(VkApiClient client, GroupActor actor, int waitTime) {
super(client, actor, waitTime);
}

@Override
public void messageNew(Integer groupId, Message message) {
public void messageNew(Integer groupId, MessageObject message) {
System.out.println("messageNew: " + message.toString());
}

Expand All @@ -384,7 +380,7 @@ public class CallbackApiLongPollHandler extends CallbackApiLongPoll {
}
```

In order to use the created ```CallbackApiLongPollHandler``` which overrides methods from CallBackApiLongPoll,
In order to use the created ```CallbackApiLongPollHandler``` which overrides methods from ```GroupLongPollApi```,
the instance of it needs to be created and method ```run``` called

```java
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/vk/api/sdk/events/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public enum Events {

@SerializedName("message_new")
MESSAGE_NEW(Message.class),
MESSAGE_NEW(MessageObject.class),

@SerializedName("message_reply")
MESSAGE_REPLY(Message.class),
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/vk/api/sdk/events/EventsHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected String confirmation() {
return null;
}

protected void messageNew(Integer groupId, Message message) {
protected void messageNew(Integer groupId, MessageObject message) {
LOG.error(OVERRIDING_ERR);
}

Expand Down