public static function sendToActiveChats($callback_function, array $data, $send_groups = true, $send_super_groups = true, $send_users = true, $date_from = null, $date_to = null)
{
$callback_path = __NAMESPACE__ . '\\Request';
if (!method_exists($callback_path, $callback_function)) {
throw new TelegramException('Method "' . $callback_function . '" not found in class Request.');
}
$chats = DB::selectChats($send_groups, $send_super_groups, $send_users, $date_from, $date_to);
$results = [];
if (is_array($chats)) {
foreach ($chats as $row) {
$data['chat_id'] = $row['chat_id'];
$results[] = call_user_func_array($callback_path . '::' . $callback_function, [$data]);
}
}
return $results;
}