Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot stop working on a server #82

Closed
evanh-shumakov opened this issue Jan 28, 2023 · 6 comments
Closed

Bot stop working on a server #82

evanh-shumakov opened this issue Jan 28, 2023 · 6 comments

Comments

@evanh-shumakov
Copy link

Bot stop working on a server started as php start_bot.php with no log information
Should I make some extra settings for my server?

@awohsen
Copy link
Contributor

awohsen commented Jan 28, 2023

How often? sometimes it stops pulling updates but there was always an error log like time out. Personally, I use webhook with ReactPHP and TDLight bot API server and seems no problem.

@evanh-shumakov
Copy link
Author

evanh-shumakov commented Jan 28, 2023

I think, it stops every three days (aproximetly)

@awohsen
Copy link
Contributor

awohsen commented Jan 28, 2023

try this:

$config->setPollingRetry(10);
$config->setPollingTimeout(120);

If didn't help, try using TDLight Telegram Bot API or Telegram Bot API server itself:

$config->setApiTelegramUrl('http://127.0.0.1:8580'); // local bot API server port

This might be helpful as well:

[Unit]
Description=Telegram-bot-api server
Wants=network-online.target
After=network.target network-online.target
StartLimitIntervalSec=60
[Service]
Type=simple
Restart=always
RestartSec=1
User=bots
ExecStart=/usr/bin/telegram-bot-api --api-id=API_ID --api-hash=API_HASH --local --http-port=8580 --dir=/home/bots/telegram-bot-api --allow-users -v1

[Install]
WantedBy=multi-user.target

evanh-shumakov pushed a commit to evanh-shumakov/boris.bot that referenced this issue Jan 28, 2023
evanh-shumakov pushed a commit to evanh-shumakov/boris.bot that referenced this issue Feb 1, 2023
@evanh-shumakov
Copy link
Author

evanh-shumakov commented Feb 1, 2023

$config->setApiTelegramUrl('http://127.0.0.1:8580'); // local bot API server port

Tryed $config->setPollingRetry(10); $config->setPollingTimeout(120); - haven't helped. The bot have collapsed again in 3 days.

Try $config->setApiTelegramUrl('http://127.0.0.1:8580'); and now I'm getting an error "Failed to call Telegram Bot Api, method: getWebhookInfo, params: [], reason: RuntimeException: Connection to tcp://127.0.0.1:8580 failed: Connection refused (ECONNREFUSED) in /vendor/react/socket/src/TcpConnector.php:140"

@awohsen
Copy link
Contributor

awohsen commented Feb 1, 2023

You should install it and set it on that specific port, follow this build instructions generator

If you don't get it read about it here : Using a Local Bot API Server) and here: Local Bot API Server Usage.

@evanh-shumakov
Copy link
Author

You should install it and set it on that specific port, follow this build instructions generator

If you don't get it read about it here : Using a Local Bot API Server) and here: Local Bot API Server Usage.

Thank you so much, and I really sorry: I use a virtual hosting for my projects, and, as it turned out, it is not permitted to use any kind of bots, so they just stoped it forced.
Thank you again for your help : )

evanh-shumakov pushed a commit to evanh-shumakov/boris.bot that referenced this issue Mar 2, 2023
…prevent bot sudden stopping. (habr issue badfarm/zanzara#82 )"

This reverts commit 2e707ae.
evanh-shumakov pushed a commit to evanh-shumakov/boris.bot that referenced this issue Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants