Releases: bivashy/java-vk-bots-long-poll-api
Releases · bivashy/java-vk-bots-long-poll-api
Release 1.2.2
<dependency>
<groupId>com.github.yvasyliev</groupId>
<artifactId>java-vk-bots-longpoll-api</artifactId>
<version>1.2.2</version>
</dependency>
Release 1.2.1
<dependency>
<groupId>com.github.yvasyliev</groupId>
<artifactId>java-vk-bots-longpoll-api</artifactId>
<version>1.2.1</version>
</dependency>
Release 1.1.0-beta
<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
<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
<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:
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:
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:
Release 1.0.27-beta
This is a beta release.