World Conquest Chronicles

World Conquest Chronicles

VK Bot, v1.1.0

Conversation with the bot

Extendable VK group bot.

Support attachments with an automatically loading and a caching.

Change Log

  • Closed issues:
    • Add an example of a command #9
    • Add a file logger #8
    • Normalize and make absolute attachments paths #5
    • Cache loaded attachments #4
    • Automatically load attachments from a command response #2
    • Support attachments in a response #1
    • Development:
      • Use class properties transform Babel plugin #7
      • Replace latest Babel preset to env Babel preset #6
      • Support a hot code reloading #3

Features

  • listen inbox messages via the long polling technology;
  • process messages by the specified outer command:
    • serialize a message object (see below for details) to the JSON format;
  • attachments:
    • support attachments in a response (see below for details);
    • automatically load attachments from a command response;
    • cache loaded attachments:
      • search in a cache by:
        • attachment path;
        • attachment basename.

Usage

$ vk-bot --version
$ vk-bot --help

Options:

  • --version — show version number;
  • --help — show help.

Environment variables:

  • VK_BOT_TOKEN — VK API access token;
  • VK_BOT_COMMAND — messages process command;
  • VK_BOT_CACHE — file where to persist cached attachments (default: ~/.vk-bot/attachments.json);
  • VK_BOT_INEXACT_CACHE — search attachments in a cache only by its basenames (allowed: TRUE);
  • VK_BOT_LOG — file where to persist a log (default: ~/.vk-bot/logs/app.log).

Environment variables can be specified in a .env file in the project folder in the format:

NAME_1=value_1
NAME_2=value_2
...

See details about the format: https://github.com/motdotla/dotenv#rules.

A .env file will never modify any environment variables that have already been set.

Attachments

/\${file:\/\/(?P<path>[^{}]+)}/

Path may be:

  • absolute;
  • relative to a current working directory.

Repository

Link: https://github.com/thewizardplusplus/vk-bot/tree/v1.1.0.

Content: code.

License: MIT.

Screenshots

Help message

Help message

Messages processing

Messages processing

Copyrights