World Conquest Chronicles

World Conquest Chronicles

VK Bot, v1.4.0

Help message

Extendable VK group bot.

Improve a photos uploading, a delays processing and a logging.

Change Log

  • Closed issues:
    • Use a community mode for a photos uploading #40
    • Update:
      • Update dependencies #33
      • Update the node-vk-bot package to v0.2.6 #35:
        • Log errors in a working with the Long Poll server #36
        • Set a zero delay before a restart of the Long Poll client #37
      • Update the node-vkapi package to v3.0.7 #38:
        • Support a custom delay between calls to VK API #39
    • npm package:
      • Use an uppercase in names of services files #31
      • Update copyright years #32
      • Add the VK_BOT_COLORFUL_LOG environment variable to the example of a .env config #34

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;
  • special responses:
    • request of a join to the group;
    • preliminary response about a receiving of a message for a processing;
    • special response on an error in a message processing;
  • respond only to a last message from several messages received simultaneously;
  • attachments:
    • support attachments in a response (see below for details);
    • automatically load attachments from a command response:
      • use a community mode for an attachments uploading;
    • cache loaded attachments:
      • search in a cache by:
        • attachment path;
        • attachment basename.

Usage

$ vk-bot --version
$ vk-bot --help
$ vk-bot [--config PATH | -c PATH]

Options:

  • --version — show version number;
  • --help — show help;
  • --config PATH, -c PATH — path to a .env config (default: ./.env).

Environment variables:

  • VK_BOT_TOKEN — VK API access token;
  • VK_BOT_GROUP — ID or screen name of the group;
  • 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);
  • VK_BOT_COLORFUL_LOG — colorize log messages (allowed: TRUE);
  • VK_BOT_PRELIMINARILY — preliminary response about a receiving of a message for a processing (default: Hello! Your message is being processed. Please, wait.);
  • VK_BOT_REQUIRE_JOIN — require join to the group before start a conversation (allowed: TRUE);
  • VK_BOT_JOIN_REQUEST — request of a join to the group (default: Hello! To talk to me, please, join my group.);
  • VK_BOT_ERROR — special response on an error in a message processing (default: I'm sorry, but error has occurred on a processing of your message. Please, try again.);
  • VK_BOT_ONLY_LAST — respond only to a last message from several messages received simultaneously (allowed: TRUE);
  • VK_BOT_API_DELAY — base delay between calls to VK API in ms (default: 50).

Environment variables can be specified in a .env config in the format:

NAME_1=value_1
NAME_2=value_2
...

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

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

Repository

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

Content: code.

License: MIT.