TKK_E32230273/auto_delete_quick.php

44 lines
1.3 KiB
PHP

<?php
/**
* Auto-delete success message after 5 seconds with LIVE per-second countdown.
* 5 → 4 → 3 → 2 → 1 → DELETE
*
* CLI: php auto_delete_quick.php <chat_id> <msg_id> <text>
*/
ignore_user_abort(true);
set_time_limit(15);
// Accept args from CLI or GET
if (php_sapi_name() === 'cli') {
$chat_id = isset($argv[1]) ? $argv[1] : '';
$msg_id = isset($argv[2]) ? $argv[2] : '';
$orig_text = isset($argv[3]) ? $argv[3] : '✅ Data Berhasil diperbarui';
} else {
$chat_id = isset($_GET['chat_id']) ? $_GET['chat_id'] : '';
$msg_id = isset($_GET['msg_id']) ? $_GET['msg_id'] : '';
$orig_text = isset($_GET['text']) ? $_GET['text'] : '✅ Data Berhasil diperbarui';
ob_start();
echo "OK";
$size = ob_get_length();
header("Content-Length: $size");
header('Connection: close');
ob_end_flush();
if (function_exists('ob_flush')) ob_flush();
flush();
if (session_id()) session_write_close();
}
if (empty($chat_id) || empty($msg_id)) exit;
$botToken = "8184881871:AAFOz6uzIgxE7rk3WttcKKrr0DtcNGIt-Ho";
$api = "https://api.telegram.org/bot" . $botToken;
// Wait for 5 seconds total before deleting (quiet period)
sleep(4);
sleep(1);
// DELETE the entire message
@file_get_contents($api . "/deleteMessage?chat_id=$chat_id&message_id=$msg_id");