Telegram Bot, v1.4
Posted on

Telegram channel bot.
Improve a logging.
Change Log
- custom logger:
- log message format:
- add a name of a logger to its messages;
- automatically add a color into log messages:
- for a JSON data;
- for an URL;
- for a path;
- support a filtering of log messages by a specification of a minimal allowed log level;
- logging to a file:
- add a saving of log messages to a specified file;
- support an automatic daily rotation of log files;
- log message format:
- use settings of the custom logger:
- for the web server logger;
- for the Telegram Bot API client logger;
- errors handling:
- extend a logging of errors in the message button handler to all errors types;
- add a logging of all errors types in the bot polling loop.
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_TOKEN— Telegram API access token;TELEGRAM_BOT_CHANNEL— Telegram channel name;TELEGRAM_BOT_PORT— bot API port (default:4000);TELEGRAM_BOT_ACCEPT_TEXT— text of the accept button (default:Accept);TELEGRAM_BOT_REJECT_TEXT— text of the reject button (default:Reject);TELEGRAM_BOT_DATABASE— path to the SQLite database file (default:./votes.db);TELEGRAM_BOT_CHANGEABLE_VOTE— flag denoting changeability of a vote (allowed:FALSEandTRUE; default:TRUE);TELEGRAM_BOT_SWAP_BUTTONS— flag denoting inversion of the order of the buttons (allowed:FALSEandTRUE; default:TRUE).
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.4.
Content: code.
License: GPL-3.0-or-later.