World Conquest Chronicles

World Conquest Chronicles

VK Bot, v1.5.0

Plea about a join to the group

Extendable VK group bot.

Support a plea about a join to the group and a disabling of a caching of loaded attachments.

Change Log

  • Closed issues:
    • Support a plea about a join to the group after each response #42
    • Support a disabling of a caching of loaded attachments #44
    • npm package:
      • Describe a community mode for a photos uploading in the README.md file #43

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:
    • join to the group:
      • request of it before a start of a conversation;
      • plea about it after each response;
    • 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_USE_CACHE — cache attachments (allowed: TRUE);
  • 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_PLEAD_JOIN — plead join to the group after each response (allowed: TRUE);
  • VK_BOT_JOIN_PLEA — plea about a join to the group (default: You aren't in my group, would you like to join it?);
  • 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.5.0.

Content: code.

License: MIT.

Screenshots

Help message

Help message

Copyrights