Node.js automation bot

 Mujhe ek Node.js automation bot banana hai jisme ye system use ho:


---


## ⚙️ BASE SYSTEM (ye sab same rehna chahiye):


### Chrome Profiles:

- Real visible Chrome window open karo (puppeteer-core + spawn)

- Har account ke liye NAYA fresh profile folder bano: chrome_profiles/profile_slotX_timestamp

- Puppeteer se connect karo: puppeteer.connect({ browserURL: http://localhost:PORT })

- Chrome path: C:\Program Files\Google\Chrome\Application\chrome.exe

- Window size: 480x920

- Chrome flags: --remote-debugging-port, --user-data-dir, --no-first-run, --no-default-browser-check

- Kaam khatam hone ke baad Chrome ko taskkill se force kill karo

- Profile folder ko delete karo (fs.rmSync recursive)


### Number System (number.txt):

- number.txt se numbers paro (ek line = ek number)

- Har number SIRF 1 baar use hoga

- Number use hone ke baad FORAN file se hata do (overwrite karo)

- globalNumbers array mein load karo, getNextNumber() se lao


### Parallel Slots:

- User se poochho: "How many profiles to run in PARALLEL?"

- Har slot ka alag debug port: BASE_PORT + slotIndex (e.g. 9322, 9323, 9324...)

- Slots 2 second stagger ke saath start hon

- Har slot apna kaam khatam hone ke baad FORAN agla number uthaye (wait nahi kare dusre slot ka)


### Delays & Timeout:

- Random delay: 1500ms se 2500ms ke beech

- Har profile ka max timeout: 2 minutes (120000ms)

- Chrome connect hone ka wait: 3 sec, phir 10 attempts retry


### Output:

- output.txt mein results append karo

- Format: #AccountNum [Slot X] | Phone: NUMBER | Status: ...


### Error Handling:

- Try/catch/finally use karo

- Finally mein: browser disconnect → Chrome kill → profile delete


### Files Structure:

number.txt       ← phone numbers (ek per line)

bot.js           ← main script

run.bat          ← launcher

check_modules.ps1 ← auto npm install

package.json

output.txt       ← results save hote hain

chrome_profiles/ ← temp folders (auto delete)


### check_modules.ps1:

Ye script required npm modules check kare, jo missing ho wo install kare.

Required modules: puppeteer-core, readline-sync


### run.bat:

- Node.js check kare

- check_modules.ps1 chalaye

- bot.js chalaye


---


## 🌐 WEBSITE TASK (ye apni website ke mutabiq likho):


Website: [WEBSITE URL YAHAN LIKHO]


Karna kya hai:

1. [STEP 1 likho]

2. [STEP 2 likho]

3. [STEP 3 likho]


Input: number.txt se phone number (format: [FORMAT BATAO, e.g. 336XXXXXXX])

Output: [KYA SAVE KARNA HAI output.txt mein]


---


Note:

- Kोई proxy nahi chahiye

- Debug port base: 9322 se shuru karo

- Sab code ek hi bot.js file mein ho



🔁 Kaise Use Karo:

  1. Upar wala pura prompt copy karo
  2. "WEBSITE TASK" section mein apni website ki details bhar do:
    • Website URL
    • Steps (kya karna hai page pe)
    • Number format
    • Output mein kya save karna hai
  3. GPT ko do — wo poora working bot bana dega

    ✅ Example — Nova Project ke liye prompt kuch aisa tha:

    Website: https://id.novapost.com/login?login_challenge=...
    Karna kya hai:
    1. Page open karo
    2. Phone number field mein number type karo (number.txt se)
    3. "Send code" button click karo
    4. Profile band karo
    Input: number.txt se phone (format: 336XXXXXXX)
    Output: Phone number + "Send code clicked" status

Comments