diff --git a/core/bot/cleanup_run.php b/core/bot/cleanup_run.php index 0e124a42..5df8138b 100644 --- a/core/bot/cleanup_run.php +++ b/core/bot/cleanup_run.php @@ -57,12 +57,12 @@ function perform_cleanup(){ cleanup_log('Telegram cleanup starting. Found ' . $rs->rowCount() . ' entries for cleanup.'); if($rs->rowCount() > 0) { while($row = $rs->fetch()) { - $cleanup_ids[] = $row['id']; if($row['skip_del_message'] == 1) { cleanup_log('Chat message for raid '.$row['raid_id'].' in chat '.$row['chat_id'].' is over 48 hours old. It can\'t be deleted by the bot. Skipping deletion and removing database entry.'); continue; } - delete_message($row['chat_id'], $row['message_id']); + if(delete_message($row['chat_id'], $row['message_id']) === false) continue; + $cleanup_ids[] = $row['id']; cleanup_log('Deleting raid: '.$row['raid_id'].' from chat '.$row['chat_id'].' (message_id: '.$row['message_id'].')'); if ($metrics){ $cleanup_total->inc(['telegram']); diff --git a/core/telegram/functions.php b/core/telegram/functions.php index 8cd278bd..9291f1cc 100644 --- a/core/telegram/functions.php +++ b/core/telegram/functions.php @@ -751,7 +751,9 @@ function curl_json_request($post_contents, $identifier) $json_response = curl_exec($curl); if($json_response === false) { - info_log(curl_error($curl)); + info_log(curl_error($curl)); + curl_close($curl); + return false; } // Close connection.