World Conquest Chronicles

World Conquest Chronicles

Telegram Bot, v1.9

Telegram channel bot.

Support Emoji in the text of messages (both text and photo) and support display a total number of votes on the buttons.

Change Log

  • publication into a specified channel:
    • sending of text messages:
      • support emojis (with aliases);
    • sending of photo messages:
      • support a photo caption:
        • support emojis (with aliases);
  • voting for messages (optional):
    • decor:
      • displaying of a voting result on buttons instead placeholders:
        • total number of votes.

Features

  • publication into a specified channel:
    • sending of text messages:
      • support the markup specifying:
        • allowed markups:
          • Markdown;
          • MarkdownV2;
          • HTML;
      • support emojis (with aliases);
    • sending of photo messages:
      • support a photo caption:
        • support the markup specifying:
          • allowed markups:
            • Markdown;
            • MarkdownV2;
            • HTML;
        • support emojis (with aliases);
  • voting for messages (optional):
    • restrictions (via a remembering in an SQLite database):
      • one vote per one user;
      • possibility change an own vote (optionally, i.e. may be disabled);
    • decor:
      • voting by an inline keyboard;
      • reverse of a buttons order (optionally);
      • customizable a buttons text via individual templates;
      • displaying of a voting result on buttons instead placeholders:
        • number of votes;
        • total number of votes;
        • percent of votes;
      • support emojis (with aliases) in a buttons text;
  • working mode:
    • run as a web service;
    • control via the RESTful API;
  • utility for a sending of requests to the API:
    • making of a path to a photo absolute.

Usage

$ telegram-bot -v | --version
$ telegram-bot -h | --help
$ telegram-bot [options]

Options:

  • -v, --version — show the version message and exit;
  • -h, --help — show this help message and exit;
  • -f PATH, --log-file PATH — base filename for rotated log files (default: ./logs/app.log);
  • -l NAME, --log-level NAME — minimal allowed log level (default: info).

Environment variables:

  • TELEGRAM_BOT_TOKENTelegram API access token;
  • TELEGRAM_BOT_CHANNELTelegram channel name;
  • TELEGRAM_BOT_PORT — bot API port (default: 4000);
  • TELEGRAM_BOT_VOTING — flag denoting allowing of voting (allowed: FALSE and TRUE; default: TRUE);
  • TELEGRAM_BOT_ACCEPT_TEXT — text of the accept button (default: :thumbsup: #{number}/#{total_number} (#{percents}%));
  • TELEGRAM_BOT_REJECT_TEXT — text of the reject button (default: :thumbsdown: #{number}/#{total_number} (#{percents}%));
  • TELEGRAM_BOT_DATABASE — path to the SQLite database file (default: ./votes.db);
  • TELEGRAM_BOT_CHANGEABLE_VOTE — flag denoting changeability of a vote (allowed: FALSE and TRUE; default: TRUE);
  • TELEGRAM_BOT_SWAP_BUTTONS — flag denoting inversion of the order of the buttons (allowed: FALSE and TRUE; default: TRUE);
  • TELEGRAM_BOT_RESTART_DELAY — delay before a bot polling restart (in milliseconds; default: 1000).

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/telegram-bot/tree/v1.9.

Content: code.

License: GPL-3.0-or-later.

Screenshots

Usage of the utility