Socket
Socket
Sign inDemoInstall

node-vk-bot-api

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-vk-bot-api - npm Package Compare versions

Comparing version 0.1.7 to 0.1.9

11

examples/bot.js

@@ -9,3 +9,3 @@ const app = require('node-vk-bot-api');

app.sendMessage({ user_id: uid, message: 'Hello, this is /start command!' });
app.sendMessage(uid, 'Hello, this is /start command!');
});

@@ -19,6 +19,3 @@

app.sendMessage({
user_id: uid,
message: `You are ${user.first_name} ${user.last_name}.`
});
app.sendMessage(uid, `You are ${user.first_name} ${user.last_name}.`, 'wall145003487_1900');
});

@@ -30,3 +27,3 @@ });

app.sendMessage({ user_id: uid, message: 'Hi!' });
app.sendMessage(uid, 'Hi!');
});

@@ -38,5 +35,5 @@

app.sendMessage({ user_id: uid, message: msg }); // => '{ response: [ 3 ] }'
app.sendMessage(uid, msg, 'wall145003487_1900'); // => '{ response: [ 3 ] }'
});
app.startLongPoll();

@@ -42,4 +42,6 @@ const request = require('request');

},
sendMessage: function(opts) {
execute.push(opts);
sendMessage: function(uid, msg, attach) {
const options = (typeof uid == 'object') ? uid : { user_id: uid, message: msg, attachment: attach };
execute.push(options);
},

@@ -74,3 +76,7 @@ getLastMessage: function(update) {

}).then(body => {
this.getLongPoll(body.response);
// if (body.failed) {
// this.startLongPoll();
// } else {
this.getLongPoll(body.response);
// }
});

@@ -97,3 +103,3 @@ });

} else {
this.getLongPoll();
this.startLongPoll();
return;

@@ -100,0 +106,0 @@ }

{
"name": "node-vk-bot-api",
"version": "0.1.7",
"version": "0.1.9",
"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",

@@ -13,3 +13,3 @@ # VK Bot API

Full example you can check in `examples` folder.
Full example you can see [here](https://github.com/bifot/node-vk-bot-api/blob/master/examples/bot.js).

@@ -24,3 +24,3 @@ ```javascript

app.sendMessage({ user_id: uid, message: 'Hello, this is /start command!' });
app.sendMessage(uid, 'Hello, this is /start command!');
});

@@ -31,3 +31,3 @@

app.sendMessage({ user_id: uid, message: 'Hi!' });
app.sendMessage(uid, 'Hi!');
});

@@ -39,3 +39,3 @@

app.sendMessage({ user_id: uid, message: msg }); // => '{ response: [ 3 ] }'
app.sendMessage(uid, msg, 'wall145003487_1900');
});

@@ -48,11 +48,11 @@

* [.auth(token)](https://www.npmjs.com/package/node-vk-bot-api#authtoken)
* [.command(command, callback)](https://www.npmjs.com/package/node-vk-bot-api#commandcommand-callback)
* [.hears(command, callback)](https://www.npmjs.com/package/node-vk-bot-api#hearscommand-callback)
* [.reserve(callback)](https://www.npmjs.com/package/node-vk-bot-api#reservecallback)
* [.sendMessage(opts)](https://www.npmjs.com/package/node-vk-bot-api#sendmessageopts)
* [.getLastMessage(update)](https://www.npmjs.com/package/node-vk-bot-api#getlastmessageupdate)
* [.getForwardMessage(update)](https://www.npmjs.com/package/node-vk-bot-api#getforwardmessageupdate)
* [.startLongPoll()](https://www.npmjs.com/package/node-vk-bot-api#startlongpoll)
* [.getLongPoll()](https://www.npmjs.com/package/node-vk-bot-api#getlongpoll)
* [.auth(token)](#authtoken)
* [.command(command, callback)](#commandcommand-callback)
* [.hears(command, callback)](#hearscommand-callback)
* [.reserve(callback)](#reservecallback)
* [.sendMessage(uid, msg, attach)](#sendmessageuid-msg-attach)
* [.getLastMessage(update)](#getlastmessageupdate)
* [.getForwardMessage(update)](#getforwardmessageupdate)
* [.startLongPoll()](#startlongpoll)
* [.getLongPoll()](#getlongpoll)

@@ -115,12 +115,20 @@ ### .auth(token)

### .sendMessage(opts)
### .sendMessage(uid, msg, attach)
| Parameter | Type | Requried |
| -----------|:---------:| ---------:|
| opts | object | yes |
| Parameter | Type | Requried |
| -----------|:---------:| ----------------------------:|
| uid | number | yes |
| msg | string | yes (no, if setten attach) |
| attach | string | yes (no, if setten msg) |
Send message (multi-dispatch).
Send message (multi-dispatch). Also you can only one argument `opts`, it's must be equal to `object` All params for this object you can see on [messages.send](https://vk.com/dev/messages.send) page.
```javascript
app.sendMessage({ user_id: data.user_id, message: 'Hello, world!' });
app.sendMessage(data.user_id, 'Hello, world!');
app.sendMessage({
user_id: data.user_id,
message: 'Hello, function takes only one argument now. It\'s opts.',
forward_messages: '123,431,544'
});
```

@@ -127,0 +135,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc