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 ответов

35 просмотров

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

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

Карта сайта