Skip to content

Конфигурация - Bots

Секция bots - массив объектов провайдеров. На текущий момент поддерживается тип tg (Telegram).
Схема: infrastructure/config/koanf/schemas/bots.schema.json.

Поля элемента bots[]:

  • enabled: boolean - включить провайдера
  • type: "tg"
  • name: map<locale, string> - локализованное имя бота
  • short_description: map<locale, string> - короткое описание
  • description: map<locale, string> - полное описание
  • menu_button:
    • text: map<locale, string>
    • type: "webapp_url" | "url"
    • url: string
  • commands: array - набор команд
    • enabled: boolean
    • command: string - основное имя команды
    • alias: string[] - альтернативные имена
    • description: map<locale, string> - описание команды
    • messages: array - сообщения, отправляемые при выполнении
      • type: "text" | "photo"
      • photo_url: string (для type="photo")
      • text: map<locale, string> (для type="text")
      • link_preview_disabled: boolean
      • disable_notification: boolean
      • buttons_location: "inline" | "keyboard"
      • buttons: [][]Button - матрица кнопок для inline/keyboard
        • Button:
          • text: map<locale, string>
          • type: "url" | "webapp_url"
          • url: string

Пример:

yaml
bots:
  - type: tg
    enabled: true
    name:
      en: "MARV Bot"
      ru: "MARV Бот"
    short_description:
      ru: "Короткое описание"
    description:
      ru: "Полное описание"
    menu_button:
      text:
        ru: "Открыть"
      type: webapp_url
      url: "https://example.bot/app"
    commands:
      - enabled: true
        command: "start"
        description:
          ru: "Начало работы"
        messages:
          - type: text
            text:
              ru: "Добро пожаловать!"
            buttons_location: inline
            buttons:
              - - text: { ru: "Открыть сайт" }
                  type: url
                  url: "https://example.com"

Рекомендации:

  • Держите тексты локализованными (минимум ru, при необходимости en).
  • Разносите длинные текстовые блоки по конфигу, не хардкодьте в коде.

Полная JSON Schema расположена в infrastructure/config/koanf/schemas/bots.schema.json.