
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
node-vk-bot-api
Advanced tools
API for VK bots, based on Long Poll.
$ npm i node-vk-bot-api
const API = require('node-vk-bot-api')
const bot = new API(process.env.TOKEN)
bot.command('start', ({ reply }) => reply('This is start!'))
bot.hears(/(car|tesla)/, ({ reply }) => reply('I love Tesla!'))
bot.on(({ reply }) => reply('What?'))
bot.listen()
Parameter | Type | Required |
---|---|---|
token | string | yes |
Create bot.
const bot = new API(process.env.TOKEN)
Parameter | Type | Required |
---|---|---|
callback | function | yes |
Add middleware.
bot.use(ctx => ctx.date = new Date())
bot.on(({ date }) => {
// Fri Nov 24 2017 16:00:21 GMT+0300 (MSK)
})
Parameter | Type | Required |
---|---|---|
command | string | yes |
callback | function | yes |
Add command w/ strict match.
bot.command('start', ({ reply }) => reply('This is start!'))
Parameter | Type | Required |
---|---|---|
command | string/regexp | yes |
callback | function | yes |
Add command w/ match like RegEx.
bot.hears(/(car|tesla)/, ({ reply }) => reply('I love Tesla!'))
Parameter | Type | Required |
---|---|---|
callback | function | yes |
Add reserved callback.
bot.on(({ reply }) => {
reply('What?')
})
Start listen.
Parameter | Type | Requried |
---|---|---|
user_id | number or array | yes |
message | string | yes (no, if setten attachment) |
attachment | string | yes (no, if setten message) |
callback | function | no |
Send a message to user.
bot.command('start', (ctx) => {
// with shortcut from context
ctx.reply('Hi, this is start!')
// function from context
ctx.sendMessage(ctx.peer_id, 'Hi, this is start!')
// simple usage
bot.reply(ctx.peer_id, 'Hi, this is start!')
})
MIT.
FAQs
🤖 VK bot framework for Node.js, based on Bots Long Poll API and Callback API
The npm package node-vk-bot-api receives a total of 50 weekly downloads. As such, node-vk-bot-api popularity was classified as not popular.
We found that node-vk-bot-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.