const fs = require('fs');
const p = require('path').join(__dirname, '..', 'bot.php');
let lines = fs.readFileSync(p, 'utf8').split(/\r?\n/);
const start = 5693;
const end = 5980;
const newBlock = `$isManualConfigLookup = ($userInfo['step'] ?? '') === 'showAccount' && $text != $buttonValues['cancel'];
$canAutoConfigLookup = empty($userInfo['step']) && ($botState['searchState']==="on" || $from_id == $admin || ($userInfo['isAdmin'] ?? false))
    && $text != $buttonValues['cancel'] && ConfigLookupService::looksLikeConfigInput($text ?? '');
if($isManualConfigLookup || $canAutoConfigLookup){
    if(!ConfigLookupService::looksLikeConfigInput($text)){
        sendMessage($mainValues['not_correct_text']);
        exit();
    }
    sendMessage($mainValues['please_wait_message'], $removeKeyboard);
    $lookupResult = ConfigLookupService::lookup($text);
    if(!$lookupResult){
        sendMessage('ای وای ، اطلاعاتت اشتباهه 😔', $isManualConfigLookup ? $cancelKey : getMainKeys());
        exit();
    }
    setUser();
    setUser(json_encode($lookupResult['configLocation'], 488), "temp");
    sendMessage("🔰مشخصات حسابت:", ConfigLookupService::buildTelegramKeyboard($lookupResult), "MarkDown");
    exit();
}`;
lines.splice(start, end - start + 1, ...newBlock.split('\n'));
fs.writeFileSync(p, lines.join('\n'));
console.log('done');
