bostrot/telegram-support-bot

docker-compose

MrKira34 opened this issue · 14 comments

Here is the error when starting your container:

version: '3'
services:
  supportbot:
    #build: .
    image: "bostrot/telegram-support-bot"
    restart: unless-stopped
    volumes:
      - ./config:/bot/config
    ports:
      - "8080:8080"
supportbot_1  | 
supportbot_1  | > telegram-support-bot@3.0.1 prod
supportbot_1  | > ts-node ./src/index.ts
supportbot_1  | 
supportbot_1  | /bot/node_modules/ts-node/src/index.ts:843
supportbot_1  |     return new TSError(diagnosticText, diagnosticCodes, diagnostics);
supportbot_1  |            ^
supportbot_1  | TSError: ⨯ Unable to compile TypeScript:
supportbot_1  | src/users.ts(1,21): error TS2307: Cannot find module '../config/strings' or its corresponding type declarations.
supportbot_1  | 
supportbot_1  |     at createTSError (/bot/node_modules/ts-node/src/index.ts:843:12)
supportbot_1  |     at reportTSError (/bot/node_modules/ts-node/src/index.ts:847:19)
supportbot_1  |     at getOutput (/bot/node_modules/ts-node/src/index.ts:1057:36)
supportbot_1  |     at Object.compile (/bot/node_modules/ts-node/src/index.ts:1411:41)
supportbot_1  |     at Module.m._compile (/bot/node_modules/ts-node/src/index.ts:1596:30)
supportbot_1  |     at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
supportbot_1  |     at Object.require.extensions.<computed> [as .ts] (/bot/node_modules/ts-node/src/index.ts:1600:12)
supportbot_1  |     at Module.load (node:internal/modules/cjs/loader:981:32)
supportbot_1  |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
supportbot_1  |     at Module.require (node:internal/modules/cjs/loader:1005:19) {
supportbot_1  |   diagnosticCodes: [ 2307 ]
supportbot_1  | }
app_supportbot_1 exited with code 1
docker-compose logs -f supportbot
Attaching to app_supportbot_1
supportbot_1  | 
supportbot_1  | > telegram-support-bot@3.0.1 prod
supportbot_1  | > ts-node ./src/index.ts
supportbot_1  | 
supportbot_1  | /bot/node_modules/ts-node/src/index.ts:843
supportbot_1  |     return new TSError(diagnosticText, diagnosticCodes, diagnostics);
supportbot_1  |            ^
supportbot_1  | TSError: ⨯ Unable to compile TypeScript:
supportbot_1  | src/users.ts(1,21): error TS2307: Cannot find module '../config/strings' or its corresponding type declarations.
supportbot_1  | 
supportbot_1  |     at createTSError (/bot/node_modules/ts-node/src/index.ts:843:12)
supportbot_1  |     at reportTSError (/bot/node_modules/ts-node/src/index.ts:847:19)
supportbot_1  |     at getOutput (/bot/node_modules/ts-node/src/index.ts:1057:36)
supportbot_1  |     at Object.compile (/bot/node_modules/ts-node/src/index.ts:1411:41)
supportbot_1  |     at Module.m._compile (/bot/node_modules/ts-node/src/index.ts:1596:30)
supportbot_1  |     at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
supportbot_1  |     at Object.require.extensions.<computed> [as .ts] (/bot/node_modules/ts-node/src/index.ts:1600:12)
supportbot_1  |     at Module.load (node:internal/modules/cjs/loader:981:32)
supportbot_1  |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
supportbot_1  |     at Module.require (node:internal/modules/cjs/loader:1005:19) {
supportbot_1  |   diagnosticCodes: [ 2307 ]
supportbot_1  | }
supportbot_1  | npm notice 
supportbot_1  | npm notice New minor version of npm available! 8.11.0 -> 8.19.2
supportbot_1  | npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.19.2>
supportbot_1  | npm notice Run `npm install -g npm@8.19.2` to update!
supportbot_1  | npm notice 
supportbot_1  | 
supportbot_1  | > telegram-support-bot@3.0.1 prod
supportbot_1  | > ts-node ./src/index.ts
supportbot_1  | 
supportbot_1  | /bot/node_modules/ts-node/src/index.ts:843
supportbot_1  |     return new TSError(diagnosticText, diagnosticCodes, diagnostics);
supportbot_1  |            ^
supportbot_1  | TSError: ⨯ Unable to compile TypeScript:
supportbot_1  | src/users.ts(1,21): error TS2307: Cannot find module '../config/strings' or its corresponding type declarations.
supportbot_1  | 
supportbot_1  |     at createTSError (/bot/node_modules/ts-node/src/index.ts:843:12)
supportbot_1  |     at reportTSError (/bot/node_modules/ts-node/src/index.ts:847:19)
supportbot_1  |     at getOutput (/bot/node_modules/ts-node/src/index.ts:1057:36)
supportbot_1  |     at Object.compile (/bot/node_modules/ts-node/src/index.ts:1411:41)
supportbot_1  |     at Module.m._compile (/bot/node_modules/ts-node/src/index.ts:1596:30)
supportbot_1  |     at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
supportbot_1  |     at Object.require.extensions.<computed> [as .ts] (/bot/node_modules/ts-node/src/index.ts:1600:12)
supportbot_1  |     at Module.load (node:internal/modules/cjs/loader:981:32)
supportbot_1  |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
supportbot_1  |     at Module.require (node:internal/modules/cjs/loader:1005:19) {
supportbot_1  |   diagnosticCodes: [ 2307 ]
supportbot_1  | }
supportbot_1  | 
supportbot_1  | > telegram-support-bot@3.0.1 prod
supportbot_1  | > ts-node ./src/index.ts
supportbot_1  | 

IN80 commented

@MrKira34, hello.

  1. Did you manage to install the bot through the docker composer?
  2. What version of the bot did you install?
  3. What operating system was used?

Adding to what @IN80 said, I see that you set the image to bostrot/telegram-support-bot. That is different then bostrot/telegram-support-bot:4.0.0. Try adding the version at the end.

@bostrot I tried to specify different versions.
@IN80 I ran it on two different servers and on my mac

  1. No
  2. I've tried different versions. Also tried the last one. 4.0.0 The error was the same everywhere.
    I tried to take a ready-made image like this:
    docker pull bostrot/telegram-support-bot:4.0.0
    When running this image, it had the error above.
    I also tried to assemble the image myself. I did this:
    git clone https://github.com/bostrot/telegram-support-bot.git
    docker build -t telegrambot .
    cp config/config-sample.yaml config/config.yaml
    docker-compose.yml file:
version: '3'
services:
  supportbot:
    image: "telegrambot"
    restart: unless-stopped
    volumes:
      - ./config:/bot/config
    ports:
      - "8080:8080"

After launching inside the container, there was an error described above.

  1. MacOS, Ubuntu 18.04, Ubuntu 22.04
    This version started for me
    spranoid
    but it is outdated and has less functionality

Can you check the project structure and if the folder config with the file config.yaml exists?

@bostrot
image

# bot settings
bot_token: 'TOKET' # support bot token
staffchat_id: 'ID' # eg. -123456789
owner_id: 'ID'
spam_time: 5 * 60 * 1000 # time (in MS) in which user may send 5 messages
spam_cant_msg: 5

parse_mode: 'MarkdownV2' # DO NOT CHANGE!

allow_private: false # Allow / disallow option for staff to chat privately
direct_reply: false # Set this to true to just forward staff users to a user chat when allow_private
auto_close_tickets: false # Close tickets after answering
anonymous_tickets: false # Include userid in tickets or not
show_auto_replied: true # Send auto replied msgs to staff chat
show_user_ticket: true # Show ticket id to user

signal_enabled: false # Enable/disable signal
signal_number: '+12345689' # Your signal number / account

web_server: true # Enable/disable web server
web_server_port: 42268 # Port for web server

dev_mode: false # Enable/disable dev mode

# customize your language
language:
  startCommandText: 'Добро пожаловать в наш чат поддержки! Задайте свой вопрос здесь.'
  faqCommandText: 'Обращаем ваше нимание, что ответ на ваш вопрос может занимать до 48 рабочих часов, в зависимости от загруженности сервиса.'
  helpCommandText: "*Доступные команды:* 
    /help 
    /faq 
    /id"
  helpCommandStaffText: "*Доступные команды:*
    /start - Получить небольшое введение
    /faq - Показать часто задаваемые вопросы
    /open - *Staff* Показывает список открытых тикетов
    /reopen - *Staff* Повторно открыть закрытый тикет
    /close - *Staff* Ответьте на тикет с этим параметром, чтобы закрыть тикет
    /clear - *Staff* Закрыть все тикеты
    /ban - *Staff* Бан пользователя в чате
    /unban - *Staff* Разбан пользователя в чате"
  contactMessage: "Благодарим Вас за обращение к нам. Мы ответим как можно скорее."
  blockedSpam: 'За последнее время вы прислали довольно много вопросов. Пожалуйста, успокойтесь и подождите, пока персонал не проверит их.'
  ticket: 'Тикет'
  closed: 'Закрыто'
  acceptedBy: 'был принят'
  dear: 'Здравствуйте'
  regards: 'С Уважением,'
  from: 'от'
  language: 'Язык'
  msg_sent: 'Сообщение отправлено пользователю'
  file_sent: 'Файл отправлен пользователю'
  usr_with_ticket: 'Тикет пользователя'
  banned: 'Забанен'
  replyPrivate: 'Ответить в приват'
  services: 'Выберите услугу из списка ниже'
  customer: 'Пользователь'
  msgForwarding: 'Ваши сообщения теперь будут отправлены к ответственным за поддержку сотрудникам: '
  back: 'Назад'
  whatSubCategory: 'Какая подкатегория лучше всего описывает ваши потребности? '
  prvChatEnded: 'Приватный чат завершен.'
  prvChatOpened: 'Приватный чат открыт с клиентом.'
  prvChatEnd: 'Завершить приватный чат'
  prvChatOpenedCustomer: 'Открыть приватный чат'
  instructionsSent: 'Инструкция отправлена вам в приват.'
  openTickets: 'Открытые Тикеты'
  support: 'Поддержка'
  prvChatOnly: 'Эту команду можно использовать только в приватном чате.'
  ticketClosed: 'Ваш билет был закрыт нашими сотрудниками. Вы можете открыть новый билет в любое время.'
  links: 'Прямые ссылки поддержки'
  textFirst: 'Пожалуйста, отправьте нам сообщение перед отправкой изображения, чтобы мы могли лучше помочь вам.'
  ticketClosedError: 'Вы не можете ответить на закрытый тикет.'
  automatedReply: 'Это автоматический ответ.'
  automatedReplyAuthor: 'black-wolf.im.'
  doesntHelp: 'Это не поможет.'
  automatedReplySent: 'Автоматический ответ был отправлен пользователю.'
  ticketReopened: 'Тикет открыт повторно.'

autoreply:
  - question: 'Вы тут?'
    answer: 'Да.'
    
# categories:
#   - name: "Техническая поддержка"
#     subgroups:
#     - name: "Для клиентов"
#       group_id: "-745612496"
#     - name: "Реселлерам"
#       group_id: "-784784964"
#   - name: "Не поступил звонок?"
#     msg: "Соблюдайте условия заказа звонка, ознакомиться с ними можно в боте @bwhelper_bot на странице заказа звонка."
#   - name: "Как настроить sip клиент"
#     msg: "@bwhelper_bot раздел Инструкция"
#  - name: "Category2"
#    subgroups:
#    - name: "Sub4"
#      group_id: "-12345678910"
#    - name: "Sub5"
#      group_id: "-12345678910"
#    - name: "Sub6"
#      group_id: "-12345678910"
#  - name: "Category with no subcategories"
#    group_id: "-12345678910"
#  - name: "Admin Chat"
#    group_id: "-12345678910"



...
supportbot_1 | > telegram-support-bot@3.0.1 prod
...

Hmm, the errors you have posted are both for version 3.0.1. So you would need to update what it says with 4.0.0.

@bostrot Any idea why this is a problem?

IN80 commented

@MrKira34 hi.
I have a problem with the latest version. I can't make the container through docker to run in the background.

@IN80 That is, you also have such a problem?

IN80 commented

@MrKira34 Yes, I can't run docker via composer.

IN80 commented

@MrKira34 hi.
My problem with docker was due to a problem with the virtual server architecture. Solved the problem completely with the help of the process command pm2. Added information to the article: https://github.com/bostrot/telegram-support-bot/wiki/Getting-started

Write your nick telegram, My partner wants to chat with you :)

@bostrot hi. You need to write about it on the main page.

Should be fixed in master branch.