All Projects → u32i64 → vk-chat-bot

u32i64 / vk-chat-bot

Licence: MIT license
📦 node package for building chat bots for VK communities (uses Callback API)

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vk-chat-bot

vkquick
Lightweight modern asynchronous framework for VK bots that can automatic build docs for your bots
Stars: ✭ 58 (+176.19%)
Mutual labels:  vk, easy
easyvk
This app helps you create an apps with vk api easy!
Stars: ✭ 97 (+361.9%)
Mutual labels:  vk, callback-api
Vk Api Schema
JSON Schema of VK API
Stars: ✭ 158 (+652.38%)
Mutual labels:  vk
vkbot
Chat-bot for vk.com
Stars: ✭ 22 (+4.76%)
Mutual labels:  vk
Swiftyvk
Easy and powerful way to interact with VK API for iOS and macOS
Stars: ✭ 247 (+1076.19%)
Mutual labels:  vk
Vk Requests
vk.com requests for humans. API library for vk.com
Stars: ✭ 162 (+671.43%)
Mutual labels:  vk
vk-api
VK SDK | VKontakte wrapper for standalone apps
Stars: ✭ 30 (+42.86%)
Mutual labels:  vk
Vk To Telegram Transfer Bot
Бот, пересылающий сообщения из чатов ВК в Telegram и обратно
Stars: ✭ 143 (+580.95%)
Mutual labels:  vk
VideoforVk
Video for Vk (or VT) is client for Vk video API.
Stars: ✭ 27 (+28.57%)
Mutual labels:  vk
Pow assent
Multi-provider authentication for your Pow enabled app
Stars: ✭ 236 (+1023.81%)
Mutual labels:  vk
slaves api
Обертка для мини-игры "рабы" на python
Stars: ✭ 13 (-38.1%)
Mutual labels:  vk
Vkapiphp
[Abandoned] Library for work with API Vk.com
Stars: ✭ 206 (+880.95%)
Mutual labels:  vk
Vk Php Sdk
PHP library for working with VK API
Stars: ✭ 169 (+704.76%)
Mutual labels:  vk
Hacktober-2019
Repo for TOM members dedicated for the Hacktober fest of 2019 (6th edition), this repo is here to encourage open source learning and sharing and enhance git/github using abilities.
Stars: ✭ 16 (-23.81%)
Mutual labels:  easy
Datmusic Api
Alternative for VK Audio API
Stars: ✭ 160 (+661.9%)
Mutual labels:  vk
ytmous
Anonymous Youtube Proxy
Stars: ✭ 60 (+185.71%)
Mutual labels:  easy
Passport Vkontakte
VK.com authentication strategy for Passport and Node.js
Stars: ✭ 149 (+609.52%)
Mutual labels:  vk
Node Vk Bot Api
🤖 VK bot framework for Node.js, based on Bots Long Poll API and Callback API.
Stars: ✭ 195 (+828.57%)
Mutual labels:  vk
Vk Java Sdk
Java library for working with VK API
Stars: ✭ 254 (+1109.52%)
Mutual labels:  vk
react-native-easy-state-view
Fully customizable State View for React Native.
Stars: ✭ 21 (+0%)
Mutual labels:  easy

vk-chat-bot

version downloads bundle size

Package for easy creation of chat bots for VK communities (groups). Uses Callback API.
documentation »changelog »featuresusagecontributinglicense

Features

  • Easy to use — setting up behavior is simple — see 2. Behavior setup below
  • Respects the quota — the package calls VK API not more then 20 times/second, so you don't exceed the quota

The version of VK API used by this package can be found here.

Usage

Installation

$ yarn add vk-chat-bot

Example

You can find an example bot in the u32i64/vk-chat-bot-example repository.

  • Deploying on Glitch

    Simply press the button below and follow the SETUP.md file there:

    remix this

  • Deploying on Heroku

    You can find a step-by-step guide on deploying the example to Heroku here.

Quick Start

1. Preparation

First, require() the package:

const vk = require('vk-chat-bot');

Then, create your bot using the vk.bot function (see Params object for more information about params):

const params = {
  vkToken: 'your_vk_access_token',
  confirmationToken: 'f123456',
  groupId: 1234567,
  secret: 's3r10us1y_s3cr3t_phr4s3',
  port: 12345,

  cmdPrefix: '/'
};

var { bot, core } = vk.bot(params);

2. Behavior setup

See Core wiki to learn more about behavior functions. Here are some examples:

// Use stuff from the package...
const { Color, button, Keyboard } = vk.kbd;

// ...to create a keyboard like this.
// +-----------+---------+----------+----------+
// | Secondary | Primary | Negative | Positive |
// +-----------+---------+----------+----------+
// |      Maximum rows is 10, columns - 4.     |
// +-------------------------------------------+
var kbd = new Keyboard([
  [ /* Row (array of buttons) */
    button.text('Secondary'),
    button.text('Primary', Color.Primary),
    button.text('Negative', Color.Negative),
    button.text('Positive', Color.Positive)
  ],
  [
    button.text('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);
});

3. Start it!

Start the bot:

bot.start();

The bot will log some useful information, see Logging documentation for more information.

Contributing

  • Something does not seem right or you have a feature request? Open an issue.
  • You know how to make vk-chat-bot better? Open a pull request!

License

This project is licensed under the terms of the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].