-2

Hello i have a telegram bot i made using php now in my bot the big problem is there is many commands and whenever a user type !start and at the same time other user type !info / !start then the bot giving response after the first user done then after the second.. I want to do is if a user send !start and at same time 2nd user sent then bot wont wait for end of first user bot will reply in short i want multiprocess / multi thread

if ((strpos($message, "/info") === 0)||(strpos($message, "!start") === 0)||(strpos($message, "!id") === 0)||(strpos($message, "!info") === 0)||(strpos($message, "/id") === 0)||(strpos($message, "/me") === 0)||(strpos($message, "/start") === 0)){
sendMessage($chatId, "<b>Telegram ID:</b> <code>$userId</code>%0A<b>Group ID: </b><code>$chatId</code>%0A<b>To Know Commands: /cmds</b>", $message_id);
}

This is an example code please give an sample code that i can understand / execute

Thanks:)

Ani
  • 1
  • What have you tried that did not work? PHP is single-threaded. – istepaniuk May 17 '22 at 22:16
  • Your question is not that clear. Telegram bots are usually pulling the message(s) through HTTPS call: https://core.telegram.org/bots/api#getting-updates. It's normally made for a "synchronous feeding/consuming" by the bot. But you are free to run processes in parallel at reception. Take a look here for multi-thread in PHP: https://stackoverflow.com/a/15501449/4389768 – OOM May 18 '22 at 07:46
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 18 '22 at 07:48
  • I want Multi Thread in My Telegram Bot which can process 2 or more msgs at the same time using php – Ani May 18 '22 at 07:59

0 Answers0