World Conquest Chronicles

World Conquest Chronicles

Telegram Bot, v1.1

Telegram channel bot.

Support photo messages.

Change Log

  • support a sending of photo messages:
    • in the web service;
    • in the sending utility;
  • making of a path to a photo absolute in the sending utility.

Features

  • publication into a specified channel:
    • sending of text messages;
    • sending of photo messages;
  • 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 of the Utility for a Sending of Requests to the API

$ ./tools/sender.bash -h
$ ./tools/sender.bash [-H HOST] [-P PORT] -t TEXT
$ ./tools/sender.bash [-H HOST] [-P PORT] -f PATH

Options:

  • -h — show this help message;
  • -H HOST — set a host name (default: localhost);
  • -P PORT — set a port number (default: 4000);
  • -t TEXT — set a message text;
  • -f PATH — set a path to a message photo.

API

API description in the Swagger format:

openapi: '3.0.0'
info:
  title: telegram-bot
  version: 1.1.0
servers:
- url: http://localhost:{port}/api/v1
  variables:
    port:
      default: '4000'
paths:
  /message:
    post:
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                text:
                  type: string
                  pattern: \S+
              required:
              - text
      responses:
        200:
          description: OK
        400:
          description: Bad Request
        500:
          description: Internal Server Error
  /photo:
    post:
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                file:
                  type: string
                  pattern: \S+
              required:
              - file
      responses:
        200:
          description: OK
        400:
          description: Bad Request
        500:
          description: Internal Server Error

Repository

Link: https://github.com/thewizardplusplus/telegram-bot/tree/v1.1.

Content: code.

License: GPL-3.0-or-later.

Screenshots

Run of the web service

Usage of the utility

POST /photo

Copyrights