I was sending messages to all my bot subscribers and when the subscribers reach about 400, my bot doesn't send messages to all but few. my code is in php and I've used the sleep() function.
I tested it and found out that while sending the message if the messages aren't sent in 1 min the sending process stops and I know there is a limit for sending messages 30 messages per second but not this.
elseif ($text == '/send' && $chatID == 353575758){
$sql = $c->query("SELECT * FROM corona ORDER BY id");
$row = $sql->num_rows;
$counter = 0;
$sent = 0;
while($exe = $sql->fetch_array()) {
if($counter < 30) {
$counter++;
$sent ++;
}
else {
$sent++;
sleep(1);
$counter = 1;
$bot->sendMessage([
'chat_id' => 353575758,
'text' => $sent,
'parse_mode' => 'HTML',
]);
}
}
$bot->sendMessage([
'chat_id' => 353575758,
'text' => "Completed - sent for ".$sent." Users",
]);
}