Guys I'm used this typing($chat_id, $action = 'typing') sleep(2); Then send a message,

but sleep(); will stop the bot completely for all users how can fix it?
I want some time to show action

58 ответов

29 просмотров

use multithreading or multiprocessing in php

sleep() doesn't stop the script, maybe your code (sendMessage) has an error

Will
sleep() doesn't stop the script, maybe your code (...

if the script is single threaded, it'll stop the processing :)

Will
sleep() doesn't stop the script, maybe your code (...

No, it stops because Telegram sends the updates one by one And it will not send the next update until it receives a response of 200

M A
No, it stops because Telegram sends the updates on...

incorrect. default max connections is 40. If one thread is sleeping, there are still 39 other threads.

M A
No, it stops because Telegram sends the updates on...

There bot is sending a msg, it can send anytime

Para TFF
incorrect. default max connections is 40. If one...

No bro, the max connection is a different parameter

Para TFF
incorrect. default max connections is 40. If one...

if not using webhooks (getUpdates), then it receives 100 at a time. It's not 1 by 1

Will
There bot is sending a msg, it can send anytime

Yes ‌But I'm talking about the webhook script to which updates are sent and the bot handles .

ッ Marshmallow 🎀 ❦ ᵐⁱˢˢ Σ ᶜᵒˡˡᵉᵍⁱᵃⁿ ᵃⁿᵈ ᵍᵃᵐᵉʳ 👱🏻‍♀ 🦋²⁰²²ᵗʰ 🎀 🧞‍♀️×͜×
Is there an easier way than that site?

Test this script on the server and then tell the result <?php if (is_callable('fastcgi_finish_request')){ echo "fastcgi_finish_request"; }elseif(is_callable('litespeed_finish_request')) { echo "litespeed_finish_request"; }else{ echo "Not support"; }

ッ Marshmallow 🎀 ❦ ᵐⁱˢˢ Σ ᶜᵒˡˡᵉᵍⁱᵃⁿ ᵃⁿᵈ ᵍᵃᵐᵉʳ 👱🏻‍♀ 🦋²⁰²²ᵗʰ 🎀 🧞‍♀️×͜×
I put it the main file

no, make a new file not the main bot script first we need check what functions are callable on your server, the use them in main script

I once created a bot with multiple php scripts running in parallel. I used passthru() to spawn a bash script, which spawned another php script in parrallel. I really don't recommend it, but it's a way if your php doesn't support multiple threads.

In sceipt first call file use fastcgi_finish_request();

Quad
I once created a bot with multiple php scripts run...

My file perfect now i have only some issues the worse one sleep(); Because i use it alot for add some time to show action

ッ Marshmallow 🎀 ❦ ᵐⁱˢˢ Σ ᶜᵒˡˡᵉᵍⁱᵃⁿ ᵃⁿᵈ ᵍᵃᵐᵉʳ 👱🏻‍♀ 🦋²⁰²²ᵗʰ 🎀 🧞‍♀️×͜×
screenshot No else black screen

U aren't running this script Because in the worst case, it should print "Not support" message https://t.me/BotTalk/625723

Yes put the codes in new file, but don't set webhook You need open it in ur browser

M A
Yes put the codes in new file, but don't set webho...

Can't open file on heroku by browser always black screen no any info And bot works fine without error log 🥲

wym

M A
wym

You want from me open the file link in browser after running it on heroku But i always got black screen without any info

ッ Marshmallow 🎀 ❦ ᵐⁱˢˢ Σ ᶜᵒˡˡᵉᵍⁱᵃⁿ ᵃⁿᵈ ᵍᵃᵐᵉʳ 👱🏻‍♀ 🦋²⁰²²ᵗʰ 🎀 🧞‍♀️×͜×
You want from me open the file link in browser aft...

Put this code in the script of the bot if (is_callable('fastcgi_finish_request')){ echo "fastcgi_finish_request"; session_write_close(); fastcgi_finish_request (); }elseif(is_callable('litespeed_finish_request')) { echo "litespeed_finish_request"; session_write_close(); litespeed_finish_request(); }else{ echo "Not support"; } then check the sleep problem solved or not

M A
Put this code in the script of the bot if (is_cal...

Let me got it I only put this file in new php file called name.php without incline "name.php"; in main file And running on heroku?

M A
No bro, the max connection is a different paramete...

Hello, good morning, I say if you do not bother, remind me how to make a tambourine robot and tame it.

M A
No, it stops because Telegram sends the updates on...

This right exactly happens to my bot After reply to my command have sleep 10 seconds No any reply to other commands before 10 seconds

Похожие вопросы

Обсуждают сегодня

А, вообще, знает кто-нить альтернативы D в области безопасных, читабельных ОО-языков?
Nik Lan
14
приветствую. хочу сделать себе D Playground вопрос: можете подсказать с чего мне следует начать и в какую сторону двигаться? P.S.: я не являюсь программистом... но в небольш...
dd
5
у тебя кастом или сток?
quantumde1 Зубенко
4
Что кто фри селф хостинг там практикует? Через tunnel?
Serg Gini
8
а как в dub выключить дебажный билд?
Maxim Filimonov
12
а почему, кстати, геймдевы обращают такое внимание на "новые" языки типа того же D (а также Zig)?
Maxim Filimonov
9
А что непонятного? В чем сложность взять слайс от вектора? И работать как обычно. Какие-то выдумки опять на ровной почве. Да и RAII в ди прекрасно работает с самого начала.
Aleksandr Druzhinin
14
> как написать простой код с правосторонними типами? enum Foo : int; как вариант, справа же. Это opaque enum без инициализатора, свойств и т.п.
Constantin F.
2
есть вопрос. за много лет, по редким обрывочным сообщениям, у меня сложилось впечатление что есть такая деликатная тема как замещение скриптов на ди (без компиляции). у себя д...
Karagy
6
А чего плохого в том, чтобы в языке статический анализатор работал всегда ? Кмк сама фишка с безопасностью раста - крутая, но реализация конечно по мне так себе, синтаксис, пр...
Александр
4
Карта сайта