Socket
Socket
Sign inDemoInstall

node-vk-bot-api

Package Overview
Dependencies
3
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.9 to 2.3.0

.travis.yml

2

.eslintrc.json
{
"extends": "airbnb-base",
"extends": "@bifot/eslint-config",
"rules": {

@@ -4,0 +4,0 @@ "semi": ["error", "never"]

@@ -11,4 +11,2 @@ const methods = require('./methods')

throw new Error('You must set token param in settings')
} else if (typeof settings === 'object' && !settings.group_id) {
throw new Error('You must set group_id param in settings')
}

@@ -15,0 +13,0 @@

@@ -8,2 +8,3 @@ const sendMessage = require('./sendMessage')

const execute = require('./execute')
const webhookCallback = require('./webhookCallback')

@@ -18,2 +19,3 @@ module.exports = {

execute,
webhookCallback,
}
{
"name": "node-vk-bot-api",
"version": "2.1.9",
"version": "2.3.0",
"description": "🤖 Vk bot framework for Node.js",
"main": "lib/index.js",
"scripts": {
"test": "mocha --exit --timeout 5000",
"eslint": "eslint .",

@@ -48,6 +49,9 @@ "eslint:fix": "eslint . --fix"

"devDependencies": {
"@bifot/eslint-config": "^1.0.2",
"chai": "^4.2.0",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^13.0.0",
"eslint-plugin-import": "^2.13.0"
"eslint-plugin-import": "^2.13.0",
"mocha": "^5.2.0"
}
}
[![node-vk-bot-api](https://img.shields.io/npm/v/node-vk-bot-api.svg?style=flat-square)](https://www.npmjs.com/package/node-vk-bot-api/)
![node-vk-bot-api](https://img.shields.io/badge/code%20style-airbnb-brightgreen.svg?style=flat-square)
![node-vk-bot-api](https://img.shields.io/travis/node-vk-bot-api/node-vk-bot-api.svg?branch=master&style=flat-square)

@@ -29,2 +30,26 @@ # node-vk-bot-api

## Webhooks
```javascript
const express = require('express')
const bodyParser = require('body-parser')
const VkBot = require('node-vk-bot-api')
const app = express()
const bot = new VkBot({
token: process.env.TOKEN,
confirmation: process.env.CONFIRMATION,
})
bot.on((ctx) => {
ctx.reply('Hello!')
})
app.use(bodyParser.json())
app.post('/', bot.webhookCallback)
app.listen(process.env.PORT)
```
## Examples

@@ -47,2 +72,3 @@

* [.startPolling([callback])](#startpollingcallback)
* [.webhookCallback(...args)](#webhookcallbackargs)

@@ -63,2 +89,6 @@ ### constructor(settings)

polling_timeout: process.env.POLLING_TIMEOUT, // in secs (25 by default)
// webhooks options only
secret: process.env.SECRET, // secret key (optional)
confirmation: process.env.CONFIRMATION, // confirmation string
})

@@ -135,2 +165,14 @@ ```

### .webhookCallback(...args)
Get webhook callback.
```js
// express
bot.webhookCallback(req, res, next)
// koa
bot.webhookCallback(ctx, next)
```
## Context Methods

@@ -137,0 +179,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc