(SELECT COUNT(*) FROM `'.TB_REQUEST_LIMITER.'` WHERE `created_at` >= :created_at_1) as LIMIT_PER_SEC_ALL,
(SELECT COUNT(DISTINCT `chat_id`) FROM `'.TB_REQUEST_LIMITER.'` WHERE `created_at` >= :created_at_1) as LIMIT_PER_SEC_ALL,
(SELECT COUNT(*) FROM `'.TB_REQUEST_LIMITER.'` WHERE `created_at` >= :created_at_2 AND ((`chat_id` = :chat_id_1 AND `inline_message_id` IS NULL) OR (`inline_message_id` = :inline_message_id AND `chat_id` IS NULL))) as LIMIT_PER_SEC,
(SELECT COUNT(*) FROM `'.TB_REQUEST_LIMITER.'` WHERE `created_at` >= :created_at_2 AND ((`chat_id` = :chat_id_1 AND `inline_message_id` IS NULL) OR (`inline_message_id` = :inline_message_id AND `chat_id` IS NULL))) as LIMIT_PER_SEC,
(SELECT COUNT(*) FROM `'.TB_REQUEST_LIMITER.'` WHERE `created_at` >= :created_at_minute AND `chat_id` = :chat_id_2) as LIMIT_PER_MINUTE
(SELECT COUNT(*) FROM `'.TB_REQUEST_LIMITER.'` WHERE `created_at` >= :created_at_minute AND `chat_id` = :chat_id_2) as LIMIT_PER_MINUTE
if($requests['LIMIT_PER_SEC']==0// No more than one message per second inside a particular chat
$chat_per_second=($requests['LIMIT_PER_SEC']==0);// No more than one message per second inside a particular chat
&&((!is_numeric($chat_id)||$chat_id>0||$inline_message_id)&&$requests['LIMIT_PER_SEC_ALL']<30)// No more than 30 messages per second globally
$global_per_second=($requests['LIMIT_PER_SEC_ALL']<30);// No more than 30 messages per second to different chats
||((!is_numeric($chat_id)||$chat_id<0)&&$requests['LIMIT_PER_MINUTE']<20)// No more than 20 messages per minute in groups and channels
$groups_per_minute=(((is_numeric($chat_id)&&$chat_id>0)||!is_null($inline_message_id))||((!is_numeric($chat_id)||$chat_id<0)&&$requests['LIMIT_PER_MINUTE']<20));// No more than 20 messages per minute in groups and channels