Skip to content

Releases: bivashy/java-vk-bots-long-poll-api

Release 1.2.2

20 Feb 11:03
Compare
Choose a tag to compare
<dependency>
  <groupId>com.github.yvasyliev</groupId>
  <artifactId>java-vk-bots-longpoll-api</artifactId>
  <version>1.2.2</version>
</dependency>

Release 1.2.1

17 Feb 13:10
7402a5c
Compare
Choose a tag to compare
<dependency>
  <groupId>com.github.yvasyliev</groupId>
  <artifactId>java-vk-bots-longpoll-api</artifactId>
  <version>1.2.1</version>
</dependency>

Release 1.1.0-beta

14 Nov 07:18
d83279a
Compare
Choose a tag to compare
<dependency>
    <groupId>com.github.yvasyliev</groupId>
    <artifactId>java-vk-bots-longpoll-api</artifactId>
    <version>1.1.0-beta</version>
</dependency>

Updates:

  • API version: 1.118
  • Added events: message_allow, message_deny, message_typing_state
  • Stories support added

Release 1.0.29-beta

13 Nov 11:33
25c3793
Compare
Choose a tag to compare
<dependency>
    <groupId>com.github.yvasyliev</groupId>
    <artifactId>java-vk-bots-longpoll-api</artifactId>
    <version>1.0.29-beta</version>
</dependency>

Added support for message_typing_state events

Release 1.0.28-beta

03 Nov 21:25
ed447a8
Compare
Choose a tag to compare
<dependency>
    <groupId>com.github.yvasyliev</groupId>
    <artifactId>java-vk-bots-longpoll-api</artifactId>
    <version>1.0.28-beta</version>
</dependency>

Keyboard support added!

1. Buttons example

Button button1 = new Button()
        .setAction(new Button.TextAction().setLabel("Positive button"))
        .setColor(Button.ButtonColor.POSITIVE);
Button button2 = new Button()
        .setAction(new Button.TextAction().setLabel("Negative button"))
        .setColor(Button.ButtonColor.NEGATIVE);
Button button3 = new Button()
        .setAction(new Button.TextAction().setLabel("Primary button"))
        .setColor(Button.ButtonColor.PRIMARY);
Button button4 = new Button()
        .setAction(new Button.TextAction().setLabel("Secondary button"))
        .setColor(Button.ButtonColor.SECONDARY);

List<Button> row1 = Arrays.asList(button1, button2);
List<Button> row2 = Arrays.asList(button3, button4);

Keyboard keyboard = new Keyboard().setButtons(Arrays.asList(row1, row2));

new MessagesSend(this)
        .setPeerId(message.getPeerId())
        .setMessage("Buttons example")
        .setKeyboard(keyboard)
        .execute();

Result:

buttons example

2. Callback button example

@Override
public void onMessageNew(MessageNewEvent messageNewEvent) {
    try {
        Message message = messageNewEvent.getMessage();
        Button button = new Button()
                .setAction(new Button.CallbackAction().setLabel("Click me"))
                .setColor(Button.ButtonColor.POSITIVE);
        Keyboard keyboard = new Keyboard()
                .setButtons(Arrays.asList(Arrays.asList(button)))
                .setInline(true);

        new MessagesSend(this)
                .setPeerId(111)
                .setMessage("A Callback button example")
                .setKeyboard(keyboard)
                .execute();
    } catch (ApiHttpException e) {
        e.printStackTrace();
    }
}

@Override
public void onMessageEvent(MessageEvent messageEvent) {
    try {
        new MessagesSendEventAnswer(this)
                .setUserId(messageEvent.getUserId())
                .setPeerId(messageEvent.getPeerId())
                .setEventId(messageEvent.getEventId())
                .setEventData(new Button.ShowSnackbar().setText("Hi there!"))
                .execute();
    } catch (ApiHttpException e) {
        e.printStackTrace();
    }
}

Result:

Callback button example

3. Carousel example

Button button1 = new Button().setAction(new Button.TextAction().setLabel("button1"));
Template.Carousel.Element element1 = new Template.Carousel.Element()
        .setTitle("Title1")
        .setDescription("Description1")
        .setButtons(Arrays.asList(button1));

Button button2 = new Button().setAction(new Button.TextAction().setLabel("button2"));
Template.Carousel.Element element2 = new Template.Carousel.Element()
        .setTitle("Title2")
        .setDescription("Description2")
        .setButtons(Arrays.asList(button2));

Template.Carousel carousel = new Template.Carousel().setElements(Arrays.asList(element1, element2));

new MessagesSend(this)
        .setPeerId(111)
        .setMessage("Carousel example")
        .setTemplate(carousel)
        .execute();

Result:

Carousel example

Release 1.0.27-beta

01 Sep 18:43
Compare
Choose a tag to compare
Release 1.0.27-beta Pre-release
Pre-release

This is a beta release.