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

API for VK bots on long poll.


Version published
Weekly downloads
214
increased by8.63%
Maintainers
1
Weekly downloads
 
Created
Source

node-vk-bot-api node-vk-bot-api

node-vk-bot-api

API for VK bots on long poll.

Install

$ npm i node-vk-bot-api

Example

const API = require('node-vk-bot-api')

const bot = new API({
  token: process.env.TOKEN
})

bot.command('start', ({ reply }) => reply('This is start!'))

bot.hears('car', ({ reply }) => reply('I love Tesla!'))

bot.on(({ reply }) => reply('What?'))

bot.listen()

Methods

constructor(options)

ParameterTypeRequried
optionsobjectyes

Create bot.

const bot = new API({
  token: process.env.TOKEN
})

.command(command, callback)

ParameterTypeRequried
commandstringyes
callbackfunctionyes

Add command w/ strict match.

bot.command('start', ({ reply }) => reply('This is start!'))

.hears(command, callback)

ParameterTypeRequried
commandstringyes
callbackfunctionyes

Add command w/ match like RegEx.

bot.hears('car', ({ reply }) => reply('I love Tesla!'))

.on(callback)

ParameterTypeRequried
callbackfunctionyes

Add reserved callback.

bot.on(({ reply }) => reply('What?'))

.listen()

Start listen.

Context Methods

.reply(message, attachment)

ParameterTypeRequried
messagestringyes (no, if setten attachment)
attachmentstringyes (no, if setten message)

Send a message to the current user.

.sendMessage(peer, command, callback)

ParameterTypeRequried
peernumberyes
messagestringyes (no, if setten attachment)
attachmentstringyes (no, if setten message)

Send a message to any user.

License

MIT.

Keywords

FAQs

Package last updated on 17 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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