umputun / tg-spam

Anti-Spam bot for Telegram and anti-spam library
https://tg-spam.umputun.dev
MIT License
221 stars 39 forks source link

Getting "Error: can't make telegram bot, Not Found" #114

Closed mendelgusmao closed 3 months ago

mendelgusmao commented 3 months ago

Hi!

I'm having trouble setting up tg-spam in a Docker environment.

I think the first time I started the container after setting the telegram token, it kinda worked, but I decided to configure what was left, it stopped working and I have no idea why.

I'm using docker-compose-with-server.yml.

Here's the log after docker-compose up

Creating network "tg-spam_default" with the default driver
Creating volume "tg-spam_tg-data" with default driver
Creating tg-spam... done
Attaching to tg-spam
tg-spam-cmin3    | tg-spam v1.13.5-68dcc02-20240804T02:25:09
tg-spam-cmin3    | 2024/08/20 16:36:57.766 [INFO]  loaded samples - spam: 182, ham: 438, excluded tokens: 279, stop-words: 11
tg-spam-cmin3    | 2024/08/20 16:36:57.792 [WARN]  generated basic auth password for user tg-spam: "MluFkEslYM2YHY(aNPcL"
tg-spam-cmin3    | 2024/08/20 16:36:57.805 [INFO]  basic auth enabled for webapi server
tg-spam-cmin3    | 2024/08/20 16:36:57.805 [INFO]  start webapi server on :8080
tg-spam-cmin3    | 2024/08/20 16:36:58.506 [ERROR] can't make telegram bot, Not Found
tg-spam-cmin3    | 2024/08/20 16:36:58.506 [ERROR] can't make telegram bot, Not Found
tg-spam-cmin3    | >>> stack trace:
tg-spam-cmin3    | main.main()
tg-spam-cmin3    |      /build/app/main.go:168 +0x5b8

Can you help me?

Thanks!

coperius commented 3 months ago

Check bot token

mendelgusmao commented 3 months ago

Check bot token

Seems fine! Even requesting https://api.telegram.org/bot[TOKEN]/getMe returns OK.

coperius commented 3 months ago

Сheck token availability inside the container.

You can add printf with your token in main.go

    // make telegram bot
    fmt.Printf("[INFO] telegram token: %s\n", opts.Telegram.Token)
    tbAPI, err := tbapi.NewBotAPI(opts.Telegram.Token)
mendelgusmao commented 3 months ago

Got it!

I was wrongly putting quotation marks in the env var in docker-compose

Thanks for pointing me the way!