Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
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 178 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
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.