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 1.1.0 to 1.1.1

6

examples/simple.js
const API = require('../index')
const { settings } = require('../config')
const { token } = require('../config')
const bot = new API(settings)
const bot = new API(token)
bot.command('start', ({ reply }) => reply('This is start!'))
bot.hears('car', ({ reply }) => reply('I love Tesla!'))
bot.hears(/(car|tesla)/, ({ reply }) => reply('I love Tesla!'))

@@ -10,0 +10,0 @@ bot.on(({ reply }) => reply('What?'))

const executeHandler = require('./utils/executeHandler')
module.exports = class Bot {
constructor (settings) {
if (!settings) {
throw 'Settings not found'
} else if (!settings.token) {
constructor (token) {
if (!token) {
throw 'Token is required'
}
this.settings = settings
this.token = token
this.methods = {}

@@ -13,0 +11,0 @@ this.actions = { commands: {}, hears: {}, on: {} }

module.exports = function (command, callback) {
const list = typeof command === 'object' && !/\/[\S]{1,}\/[a-z]{1,2}/.test(command)
const list = typeof command === 'object' && !(command instanceof RegExp)
? command : [command]

@@ -4,0 +4,0 @@ const string = list

@@ -10,3 +10,3 @@ const rp = require('request-promise')

lp_version: 2,
access_token: this.settings.token,
access_token: this.token,
v: 5.65

@@ -80,3 +80,3 @@ })

v: 5.67
}, this.settings.token, (data) => {
}, this.token, (data) => {
resolve(this.getLastMessage(data.items[0]))

@@ -83,0 +83,0 @@ })

@@ -6,5 +6,5 @@ module.exports = function (peer, message, attachment) {

attachment: attachment
}, this.settings.token, null)
}, this.token, null)
return this
}
{
"name": "node-vk-bot-api",
"version": "1.1.0",
"version": "1.1.1",
"description": "API for VK bots on long poll.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,9 +19,7 @@ [![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/)

const bot = new API({
token: process.env.TOKEN
})
const bot = new API(process.env.TOKEN)
bot.command('start', ({ reply }) => reply('This is start!'))
bot.hears('car', ({ reply }) => reply('I love Tesla!'))
bot.hears(/(car|tesla)/, ({ reply }) => reply('I love Tesla!'))

@@ -45,3 +43,3 @@ bot.on(({ reply }) => reply('What?'))

|:-----------|:---------:| ---------:|
| options | object | yes |
| token | string | yes |

@@ -48,0 +46,0 @@ Create bot.

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