Global

Members

(readonly) colors :Object

Colors of buttons in a keyboard

Properties:
Name Type Description
primary string

the primary color

default string

the default color

negative string

the negative color

positive string

the positive color

Source:
Type:
  • Object

vk :Object

The exported object. Use it to get what you need.

Properties:
Name Type Description
bot function

the quick creation function, bot

Bot class

the Bot class

Core class

the Core class

API class

the API class

Context class

the Context class

kbd Object

keyboard classes, see Keyboard, Button, and colors

log Object

logging functions, see log module

Stats class

the Stats class

Source:
Type:
  • Object
Example
const vk = require('vk-chat-bot')
// ...

Methods

bot(params) → {core_and_bot}

Creates all the necessary objects for the bot and the Bot object itself

Source:
Parameters:
Name Type Description
params Object

parameters object

Name Type Attributes Default Description
vk_token string

an API token of a VK community

confirmation_token string

confirmation token from Callback API settings

group_id string

group ID from Callback API settings

secret string

secret key (can be set in Callback API settings)

port number

the port bot will run at

cmd_prefix string <optional>
""

each command (for Core#cmd handlers) should start with this prefix to be recognized

Returns:
Type:
core_and_bot

core and bot objects

Example
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)

Type Definitions

core_and_bot

Properties:
Name Type Description
core Core

the Core object

bot Bot

the Bot object

Source:
Type:
  • Object

handler($)

A handler

Source:
Parameters:
Name Type Description
$ Context

a Context object

payload_tester(payload_json, payload) → {boolean}

Payload tester

Source:
Parameters:
Name Type Description
payload_json string

payload

payload Object

parsed payload

Returns:
Type:
boolean

is this payload suitable for this handler?