ruitunion-org / feedback-bot

A free and open-source Telegram Bot that allows you to anonymously chat with multiple users in one Telegram Chat.
GNU General Public License v3.0
43 stars 2 forks source link

Bad Request: chat not found #6

Open alexstep opened 1 month ago

alexstep commented 1 month ago

After start, service crash with exception

      Now listening on: http://[::]:8080
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /app
fail: Microsoft.Extensions.Hosting.Internal.Host[9]
      BackgroundService failed
      Telegram.Bot.Exceptions.ApiRequestException: Bad Request: chat not found
         at Telegram.Bot.TelegramBotClient.MakeRequestAsync[TResponse](IRequest`1 request, CancellationToken cancellationToken)
         at Telegram.Bot.TelegramBotClientExtensions.SetMyCommandsAsync(ITelegramBotClient botClient, SetMyCommandsRequest request, CancellationToken cancellationToken)
         at Bot.Worker.ExecuteAsync(CancellationToken ct) in /app/Worker.cs:line 29

my docker-compose.yml

version: "3.8"

services:
  bot:
    container_name: feedback_bot_app
    image: ghcr.io/ruitunion-org/feedback-bot:latest
    restart: always
    depends_on:
      - database
    environment:
      - AppOptions__DbConnectionString=Host=database;Port=5432;Database=feedback_bot;Username=postgres;Password=dbpass
      - AppOptions__FeedbackBotToken=7180076991:AAG_XXXXXXXXXXXXXXXXXXX-Omc
      - AppOptions__FeedbackBotId=7180076991
      - AppOptions__FeedbackChatId=2197208351
      - AppOptions__Start="Hello! 👋 ✉️ Write your wishes, and our team will receive them \n ✅ We will keep you updated on changes.\n Thank you! 💟"
      - AppOptions__Help="Feedback bot"

  database:
    container_name: feedback_bot_db
    image: postgres:16.3-alpine3.20
    restart: always
    environment:
      POSTGRES_DB: feedback_bot
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: dbpass
    volumes:
      - ./DATA/postgres/:/var/lib/postgresql/data
alexios-oss commented 1 month ago

Hello.

Try to add -100 in front of the chat id. So instead of 2197208351, set -1002197208351. It looks like the desktop client shows the ID without the -100. You can also check IDs using bots: https://t.me/username_to_id_bot.

alexios-oss commented 1 month ago

I think the application should support both variants, so I added a bug label to the issue.

smellilac commented 1 month ago

Hello. The chat id ("FeedbackChatId": 994979069) works fine for me, but I don't understand how you use scope (Scope = new BotCommandScopeChatAdministrators()) in private chat. Are you sure the scope is correct? I am attaching an excerpt of the log: [ERR] Telegram API Error: Bad Request: can't use specified scope in private chats