vk-plus-plus
Simple and fast VK api with Long Poll support
Install
$ npm i vk-plus-plus -s
Example
const VK = require('vk-plus-plus');
const bot = new VK({
token: '<your tokenhere>',
version: '5.80',
useExecute: true
});
bot.on('message_new', (message) => {
if(message.text.toLowerCase().trim() == 'hello') {
bot.messages.send({
user_id: message.from_id,
message: 'hello'
}).then((message_id) => {
console.log('Message successfully sent. Message ID = ' + message_id);
bot.stopBot();
})
}
});
bot.startBot();
Methods
startBot()
- Just starts longpoll queriesstopBot()
- Stops longpollon(eventName, listener)
- Add event listener. Event description- other methods can be found on official VK Developers page