node-vk-bot-api
Advanced tools
Comparing version 0.3.1 to 0.3.2
22
index.js
const request = require('request'); | ||
const api = require('./method'); | ||
const group = {}; | ||
const action = {}; | ||
var execute = []; | ||
var longPollParams = {}; | ||
var group = {}; | ||
var action = {}; | ||
@@ -10,4 +12,2 @@ action.commands = {}; | ||
let execute = []; | ||
setInterval(() => { | ||
@@ -121,3 +121,5 @@ if (execute.length) { | ||
} else { | ||
this.getLongPoll(body.response); | ||
longPollParams = body.response; | ||
this.getLongPoll(); | ||
} | ||
@@ -127,3 +129,3 @@ }); | ||
}, | ||
getLongPoll: function(longPollParams) { | ||
getLongPoll: function() { | ||
request({ | ||
@@ -153,3 +155,3 @@ url: `https://${longPollParams.server}`, | ||
if (!updates || updates.length == 0) { | ||
this.getLongPoll(longPollParams); | ||
this.getLongPoll(); | ||
return; | ||
@@ -176,3 +178,5 @@ } | ||
this.replyMessage(update); | ||
}).catch(() => { | ||
}).catch(err => { | ||
console.log(err); | ||
this.sendMessage(uid, group.mode.msg); | ||
@@ -185,3 +189,3 @@ }); | ||
this.getLongPoll(longPollParams); | ||
this.getLongPoll(); | ||
} | ||
@@ -188,0 +192,0 @@ }); |
{ | ||
"name": "node-vk-bot-api", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Clean API for VK bots based on long poll with multi-dispatch send messages (~75 per second).", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -55,3 +55,3 @@ [![node-vk-bot-api](https://img.shields.io/npm/v/node-vk-bot-api.svg)](https://www.npmjs.com/package/node-vk-bot-api/) | ||
* [.startLongPoll()](#startlongpoll) | ||
* [.getLongPoll(longPollParams)](#getlongpolllongpollparams) | ||
* [.getLongPoll()](#getlongpoll) | ||
@@ -204,8 +204,4 @@ ### .auth(token, opts) | ||
### .getLongPoll(longPollParams) | ||
### .getLongPoll() | ||
| Parameter | Type | Requried | | ||
| ----------------|:---------:| ---------:| | ||
| longPollParams | object | yes | | ||
Start long poll. | ||
@@ -212,0 +208,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
214
13840
210