
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.
vk-chat-bot
Advanced tools
Framework for easy creation of chat bots for VK communities (uses Callback API).
A chat bot framework for VK communities (groups).
documentation » ⋅ changelog » ⋅ features ⋅ usage ⋅ contributing ⋅ license
$ npm i vk-chat-bot
You can find the example in the vk-chat-bot-example
repository.
Also, you can take a look at the step-by-step Heroku Deploy Guide, which will guide you through the process of deploying vk-chat-bot-example
to Heroku.
First, require()
the framework:
const vk = require('vk-chat-bot')
Then, create your bot using the vk.bot
function (see Params object for more information about params
):
var params = {
vk_token: 'your_vk_access_token',
confirmation_token: 'f123456',
group_id: 1234567,
secret: 's3r10us1y_s3cr3t_phr4s3',
port: 12345,
cmd_prefix: "/"
}
var {bot, core} = vk.bot(params)
See Core
wiki to learn more about behavior functions.
Here are some examples:
// Use stuff from the framework...
var Keyboard = vk.kbd.Keyboard
var Button = vk.kbd.Button
var colors = vk.kbd.colors
// ...to create a keyboard like this.
// +---------+---------+----------+----------+
// | Default | Primary | Negative | Positive |
// +---------+---------+----------+----------+
// | Maximum rows is 10, columns - 4. |
// +-----------------------------------------+
var kbd = new Keyboard([
[ /* Row (array of buttons) */
new Button('Default'),
new Button('Primary', colors.primary),
new Button('Negative', colors.negative),
new Button('Positive', colors.positive)
],
[
new Button('Maximum rows is 10, columns - 4.')
],
])
// When user presses the `Start` button...
// (you have to enable the button in community settings)
core.on('start', $ => {
// ...send them our keyboard.
$.text("Thanks for messaging us! Choose from the options below:")
$.keyboard(kbd)
// Here, $.send() is added automatically.
})
// Searches for cmd_prefix + 'help', e.g. "/help"
core.cmd('help', $ => {
// core.help() returns the help message
$.text('Test Bot v1.0' + core.help())
// Attach an image from
// https://vk.com/team?z=photo6492_45624077
$.attach('photo', 6492, 456240778)
}, 'shows the help message')
// Use case-insensitive regular expression to find words "hi", "hello" or "hey"
core.regex(/h(i|ello|ey)/i, $ => {
$.text('Hello, I am a test bot. You said: ' + $.msg)
})
Start the bot:
bot.start()
The bot will log some useful information, see Logging wiki for more information.
vk-chat-bot
better? Open a pull request!This project is licensed under the terms of the MIT license.
[10.3.0] - 2018-08-23
payload
wiki.??y ??d ??h ??m ??s
cmd
handlers did not want to count it as a proper command. This is now fixed.FAQs
Package for easy creation of chat bots for VK communities (uses Callback API).
The npm package vk-chat-bot receives a total of 4 weekly downloads. As such, vk-chat-bot popularity was classified as not popular.
We found that vk-chat-bot 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.