but sleep(); will stop the bot completely for all users how can fix it?
I want some time to show action
Php No library only function
use multithreading or multiprocessing in php
sleep() doesn't stop the script, maybe your code (sendMessage) has an error
one of the first results on Google with "PHP async": https://www.educba.com/php-async/
if the script is single threaded, it'll stop the processing :)
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
incorrect. default max connections is 40. If one thread is sleeping, there are still 39 other threads.
There bot is sending a msg, it can send anytime
No bro, the max connection is a different parameter
if not using webhooks (getUpdates), then it receives 100 at a time. It's not 1 by 1
Is there an easier way than that site?
Yes But I'm talking about the webhook script to which updates are sent and the bot handles .
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"; }
I don't know how to use it I building my own file and my functions
Start with introduction https://docs.madelineproto.xyz/docs/CREATING_A_CLIENT.html
No thanks i use heroku
What is this? :/ Put the codes in a new php file, then run it
I put it the main file
No, I mean you can use MadelineProto instead of official tg api
I don't want to waste my time learning that I know api telegram since 2 years
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.
Idk I'm use heroku i can't see the log outside heroku
In sceipt first call file use fastcgi_finish_request();
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
:/ Just make test.php Put the codes and open url/test.php
Who cares for the logs. this was about you calling the test script. not telegram.
So you named your test script index.php? I don't see the file name in the url.
U aren't running this script Because in the worst case, it should print "Not support" message https://t.me/BotTalk/625723
https://myappname.herokuapp.com/test.php It's didn't appear after click on it
It's working on 000webhost but heroku different i know error only from log
I changed the app name myappname 🙂
Yes put the codes in new file, but don't set webhook You need open it in ur browser
Maybe need to create .htaccess file to see error log of php
Can't open file on heroku by browser always black screen no any info And bot works fine without error log 🥲
I also worked with Heroku There is no such problem :/
Can show your data after click on link your file?
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
You want from me open the file link in browser after running it on heroku But i always got black screen without any info
This is not possible bro If you open the link correctly, you will receive a message
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
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?
No just add it on the bot script file (The beginning of the script)
The main file one?
Hello, good morning, I say if you do not bother, remind me how to make a tambourine robot and tame it.
Forgive me, God, I do not know
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
Обсуждают сегодня