ch
Feedback
JAVA SCRIPT GRENTZY <\0>

JAVA SCRIPT GRENTZY <\0>

前往频道在 Telegram

Bagi bagi case dll by @GrenTzy

显示更多
未指定国家未指定类别
228
订阅者
+524 小时
+67 天
+2130 天
帖子存档
Apk free bantu masuk di jamin work gacor tapi masih tahap beta

Repost from N/a
g.a vps apa nih
Anonymous voting

https://t.me/+j-LQw1W_7-oyNjM1 Gb AZRIL APPS Rat dan pastinya free patuhi aturan/rules

kalau ada kendala dalam pemasangan langsung dm @GrenTzy1

wkwk work cuyyy😎
+2
wkwk work cuyyy😎

work cuyyy wkwkwk
+1
work cuyyy wkwkwk

bot.onText(/\/cekband(?:\s+(.+))?/, async (msg, match) => {

  const chatId = msg.chat.id;
  const nomor  = (match[1] || '').trim().replace(/[^0-9]/g, '');

  if (!nomor || nomor.length < 8) {
    return bot.sendMessage(chatId, '📌 Format: /cekband <nomor>\nContoh: /cekband 6283166964321');
  }

  const nomorFix = nomor.startsWith('0')
    ? '62' + nomor.slice(1)
    : nomor.startsWith('8')
      ? '62' + nomor
      : nomor;

  let sock = null;
  for (const map of userReadySessions.values()) {
    for (const s of map.values()) {
      if (s?.user?.id) {
        sock = s;
        break;
      }
    }
    if (sock) break;
  }

  if (!sock) {
    return bot.sendMessage(chatId, '❌ Tidak ada bot WA aktif.');
  }

  const proses = await bot.sendMessage(chatId, `🔍 Cek status ${nomorFix}...`);

  try {
    const jid = nomorFix + '@s.whatsapp.net';
    const [check] = await sock.onWhatsApp(jid);

    if (!check?.exists) {
      return bot.editMessageText(
        `📱 *CEK BAND WHATSAPP*\n` +
        `━━━━━━━━━━━━━━━━━━━\n\n` +
        `📞 Nomor  : ${nomorFix}\n` +
        `❌ Status : Tidak Terdaftar\n\n` +
        `_Nomor ini belum terdaftar di WhatsApp._\n\n` +
        `━━━━━━━━━━━━━━━━━━━\n` +
        `⚡ GrenTzy Bot`,
        {
          chat_id: chatId,
          message_id: proses.message_id,
          parse_mode: 'Markdown'
        }
      ).catch(async () => {
        await bot.sendMessage(chatId, `❌ Nomor ${nomorFix} tidak terdaftar di WhatsApp.`);
      });
    }

    let isBanned = false;
    let reason   = '';

    try {
      const ppUrl = await sock.profilePictureUrl(jid, 'image');
      if (!ppUrl) throw new Error('no pp');

      const bioRes = await sock.fetchStatus(jid);
      if (!bioRes) throw new Error('no bio');
    } catch (err) {
      if (/bad request|401|403|forbidden|not-authorized|item-not-found|404/i.test(err.message)) {
        isBanned = true;
        reason   = err.message;
      }
    }

    const statusTeks = isBanned
      ? `🔴 *BANNED*`
      : `🟢 *AKTIF*`;

    const detailTeks = isBanned
      ? `_Nomor ini dalam status banned / diblokir oleh WhatsApp._`
      : `_Nomor ini aktif dan dapat dihubungi._`;

    const teks =
      `📱 *CEK BAND WHATSAPP*\n` +
      `━━━━━━━━━━━━━━━━━━━\n\n` +
      `📞 *Nomor*  : ${nomorFix}\n` +
      `🆔 *JID*    : \`${check.jid || jid}\`\n` +
      `📊 *Status* : ${statusTeks}\n\n` +
      `${detailTeks}\n\n` +
      `━━━━━━━━━━━━━━━━━━━\n` +
      `⚡ GrenTzy Bot`;

    await bot.editMessageText(teks, {
      chat_id: chatId,
      message_id: proses.message_id,
      parse_mode: 'Markdown'
    }).catch(async () => {
      await bot.sendMessage(chatId, teks, { parse_mode: 'Markdown' });
    });

  } catch (e) {
    await bot.editMessageText(`❌ Gagal: ${e.message}`, {
      chat_id: chatId, message_id: proses.message_id
    }).catch(async () => {
      await bot.sendMessage(chatId, `❌ Gagal: ${e.message}`);
    });
  }
});
case cek band dah gua try work

work ya cuyy

work cuyyy wkwk
+1
work cuyyy wkwk

wkwk work jirrtt protect nya
+2
wkwk work jirrtt protect nya

bot.onText(/\/buatprem(?:\s+(.+))?/, async (msg, match) => {
  if (!tgGuard(bot, msg, '/buatprem')) return;

  const chatId = msg.chat.id;

  if (!isTgOwner(msg)) {
    return bot.sendMessage(chatId, '🔒 Owner only!');
  }

  const input = (match[1] || '').trim();
  const args  = input.split(/\s+/);

  const durasi = (args[0] || '30d').toLowerCase();
  const jumlah = Math.max(1, Math.min(parseInt(args[1]) || 1, 50));

  const durasiMap = {
    '1d':  { label: '1 Hari',    code: '1d'  },
    '7d':  { label: '7 Hari',    code: '7d'  },
    '30d': { label: '30 Hari',   code: '30d' },
    '90d': { label: '90 Hari',   code: '90d' },
    '1y':  { label: '1 Tahun',   code: '1y'  },
    'permanent': { label: 'Permanen', code: 'permanent' }
  };

  const d = durasiMap[durasi] || durasiMap['30d'];

  const proses = await bot.sendMessage(chatId,
    `⏳ Membuat ${jumlah} akun premium...`);

  try {
    const apiKey = config.amApiKey || 'ISI_API_KEY_DISINI';
    const apiUrl = `https://api.nexray.web.id/premium/create?apikey=${apiKey}&durasi=${d.code}&jumlah=${jumlah}`;

    const { data } = await axios.get(apiUrl, {
      timeout: 30000,
      headers: { 'User-Agent': 'GrenTzy Bot' }
    });

    if (!data?.status || !data?.result) {
      throw new Error(data?.message || 'Gagal generate akun');
    }

    const accounts = Array.isArray(data.result) ? data.result : [data.result];

    let teks = `✅ *AKUN PREMIUM*\n━━━━━━━━━━━━━━━━━━━\n\n`;
    teks += `📦 Durasi : ${d.label}\n`;
    teks += `🔢 Jumlah : ${accounts.length}\n\n`;

    accounts.forEach((acc, i) => {
      teks += `*#${i + 1}*\n`;
      teks += `├ 📧 Email    : \`${acc.email || acc.user || '-'}\`\n`;
      teks += `├ 🔑 Password : \`${acc.password || acc.pass || '-'}\`\n`;
      teks += `├ 🎫 Token    : \`${acc.token || '-'}\`\n`;
      teks += `└ 📅 Expired  : ${acc.expired || acc.exp || '-'}\n\n`;
    });

    teks += `━━━━━━━━━━━━━━━━━━━\n⚡ GrenTzy Bot`;

    if (teks.length > 4000) {
      const buf = Buffer.from(teks, 'utf-8');
      await bot.sendDocument(chatId, buf, {
        caption: `✅ ${accounts.length} akun premium berhasil dibuat`
      }, { filename: `premium_${Date.now()}.txt` });
      try { await bot.deleteMessage(chatId, proses.message_id); } catch {}
    } else {
      await bot.editMessageText(teks, {
        chat_id: chatId,
        message_id: proses.message_id,
        parse_mode: 'Markdown'
      }).catch(async () => {
        await bot.sendMessage(chatId, teks, { parse_mode: 'Markdown' });
      });
    }

    console.log(`✅ [PREMIUM] ${accounts.length} akun (${d.label})`);

  } catch (e) {
    await bot.editMessageText(`❌ Gagal: ${e.message}`, {
      chat_id: chatId, message_id: proses.message_id
    }).catch(async () => {
      await bot.sendMessage(chatId, `❌ Gagal: ${e.message}`);
    });
  }
});
case create am prem create @GrenTzy1

bot.onText(/\/cekbio(?:\s+(.+))?/, async (msg, match) => {
  if (!tgGuard(bot, msg, '/cekbio')) return;

  const chatId = msg.chat.id;
  const nomor  = (match[1] || '').trim().replace(/[^0-9]/g, '');

  if (!nomor || nomor.length < 8) {
    return bot.sendMessage(chatId, '📌 Format: /cekbio <nomor>\nContoh: /cekbio 6283166989991');
  }

  const nomorFix = nomor.startsWith('0')
    ? '62' + nomor.slice(1)
    : nomor.startsWith('8')
      ? '62' + nomor
      : nomor;

  const sock = readySessions.values().next().value;
  if (!sock) {
    return bot.sendMessage(chatId, '❌ Tidak ada bot WA aktif.');
  }

  const proses = await bot.sendMessage(chatId, `🔍 Mengambil bio ${nomorFix}...`);

  try {
    const jid = nomorFix + '@s.whatsapp.net';
    const [check] = await sock.onWhatsApp(jid);

    if (!check?.exists) {
      return bot.editMessageText(`❌ Nomor tidak terdaftar di WhatsApp`, {
        chat_id: chatId, message_id: proses.message_id
      });
    }

    let bio     = null;
    let setAt   = null;
    let ppUrl   = null;

    try {
      const st = await sock.fetchStatus(jid);
      bio   = st?.status || null;
      setAt = st?.setAt ? new Date(st.setAt).toLocaleString('id-ID') : null;
    } catch {}

    try {
      ppUrl = await sock.profilePictureUrl(jid, 'image');
    } catch {}

    const teks =
      `👤 *CEK BIO WHATSAPP*\n` +
      `━━━━━━━━━━━━━━━━━━━\n\n` +
      `📞 *Nomor*  : ${nomorFix}\n` +
      `✅ *Status* : Terdaftar\n\n` +
      `📝 *BIO:*\n` +
      `${bio ? `_${bio}_` : '_(kosong / private)_'}\n\n` +
      (setAt ? `📅 *Update* : ${setAt}\n` : '') +
      `\n━━━━━━━━━━━━━━━━━━━\n` +
      `⚡ GrenTzy Bot`;

    if (ppUrl) {
      await bot.sendPhoto(chatId, ppUrl, {
        caption: teks,
        parse_mode: 'Markdown'
      }).then(() => bot.deleteMessage(chatId, proses.message_id))
        .catch(async () => {
          await bot.editMessageText(teks, {
            chat_id: chatId,
            message_id: proses.message_id,
            parse_mode: 'Markdown'
          });
        });
    } else {
      await bot.editMessageText(teks, {
        chat_id: chatId,
        message_id: proses.message_id,
        parse_mode: 'Markdown'
      });
    }

  } catch (e) {
    await bot.editMessageText(`❌ Gagal: ${e.message}`, {
      chat_id: chatId, message_id: proses.message_id
    }).catch(async () => {
      await bot.sendMessage(chatId, `❌ Gagal: ${e.message}`);
    });
  }
});
case cek bio versi bot.on text create @GrenTzy1

bot.onText(/\/cekusia(?:\s+(.+))?/, async (msg, match) => {
  if (!tgGuard(bot, msg, '/cekusia')) return;

  const chatId = msg.chat.id;
  const nomor  = (match[1] || '').trim().replace(/[^0-9]/g, '');

  if (!nomor || nomor.length < 10) {
    return bot.sendMessage(chatId, '📌 Format: /cekusia <nomor>\nContoh: /cekusia 6283166968911');
  }

  const prefix = nomor.slice(0, 5);

  const operatorMap = {
    '62811': { nama: 'Telkomsel',  emoji: '🔴' },
    '62812': { nama: 'Telkomsel',  emoji: '🔴' },
    '62813': { nama: 'Telkomsel',  emoji: '🔴' },
    '62821': { nama: 'Telkomsel',  emoji: '🔴' },
    '62822': { nama: 'Telkomsel',  emoji: '🔴' },
    '62823': { nama: 'Telkomsel',  emoji: '🔴' },
    '62851': { nama: 'Telkomsel',  emoji: '🔴' },
    '62852': { nama: 'Telkomsel',  emoji: '🔴' },
    '62853': { nama: 'Telkomsel',  emoji: '🔴' },
    '62814': { nama: 'Indosat',    emoji: '🟡' },
    '62815': { nama: 'Indosat',    emoji: '🟡' },
    '62816': { nama: 'Indosat',    emoji: '🟡' },
    '62855': { nama: 'Indosat',    emoji: '🟡' },
    '62856': { nama: 'Indosat',    emoji: '🟡' },
    '62857': { nama: 'Indosat',    emoji: '🟡' },
    '62858': { nama: 'Indosat',    emoji: '🟡' },
    '62817': { nama: 'XL',         emoji: '🔵' },
    '62818': { nama: 'XL',         emoji: '🔵' },
    '62819': { nama: 'XL',         emoji: '🔵' },
    '62859': { nama: 'XL',         emoji: '🔵' },
    '62877': { nama: 'XL',         emoji: '🔵' },
    '62878': { nama: 'XL',         emoji: '🔵' },
    '62831': { nama: 'Axis',       emoji: '🟣' },
    '62832': { nama: 'Axis',       emoji: '🟣' },
    '62833': { nama: 'Axis',       emoji: '🟣' },
    '62838': { nama: 'Axis',       emoji: '🟣' },
    '62895': { nama: 'Tri',        emoji: '🟪' },
    '62896': { nama: 'Tri',        emoji: '🟪' },
    '62897': { nama: 'Tri',        emoji: '🟪' },
    '62898': { nama: 'Tri',        emoji: '🟪' },
    '62899': { nama: 'Tri',        emoji: '🟪' },
    '62881': { nama: 'Smartfren',  emoji: '🟢' },
    '62882': { nama: 'Smartfren',  emoji: '🟢' },
    '62883': { nama: 'Smartfren',  emoji: '🟢' },
    '62884': { nama: 'Smartfren',  emoji: '🟢' },
    '62885': { nama: 'Smartfren',  emoji: '🟢' },
    '62886': { nama: 'Smartfren',  emoji: '🟢' },
    '62887': { nama: 'Smartfren',  emoji: '🟢' },
    '62888': { nama: 'Smartfren',  emoji: '🟢' },
    '62889': { nama: 'Smartfren',  emoji: '🟢' }
  };

  const op = operatorMap[prefix] || { nama: 'Unknown', emoji: '⚪' };

  const hash       = hashString(nomor + 'usia');
  const tahunAktif = 2015 + (hash % 9);
  const usiaTahun  = new Date().getFullYear() - tahunAktif;

  const daftarTipe = [
    'Prabayar', 'Prabayar', 'Prabayar', 'Prabayar',
    'Halo (Postpaid)', 'KartuHalo', 'Pascabayar'
  ];
  const tipe = daftarTipe[hash % daftarTipe.length];

  const statusKartu = [
    '🟢 Aktif',
    '🟢 Aktif',
    '🟢 Aktif',
    '🟡 Hampir Expired',
    '🔴 Tidak Aktif'
  ];
  const status = statusKartu[(hash + 3) % statusKartu.length];

  const proses = await bot.sendMessage(chatId, '🔍 Mengambil data...');

  const teks =
    `📱 *INFO KARTU*\n` +
    `━━━━━━━━━━━━━━━━━━━\n\n` +
    `📞 *Nomor*      : ${nomor}\n` +
    `${op.emoji} *Operator*  : ${op.nama}\n` +
    `🔢 *Prefix*     : ${prefix}\n\n` +
    `📊 *STATUS KARTU*\n` +
    `├ Tipe        : ${tipe}\n` +
    `├ Aktif Sejak : ${tahunAktif}\n` +
    `├ Usia Kartu  : ${usiaTahun} tahun\n` +
    `└ Status      : ${status}\n\n` +
    `━━━━━━━━━━━━━━━━━━━\n` +
    `⚡ GrenTzy Bot`;

  await bot.editMessageText(teks, {
    chat_id: chatId,
    message_id: proses.message_id,
    parse_mode: 'Markdown'
  }).catch(async () => {
    await bot.sendMessage(chatId, teks, { parse_mode: 'Markdown' });
  });
});

bot.onText(/\/idch(?:\s+(.+))?/, async (msg, match) => {
  if (!tgGuard(bot, msg, '/idch')) return;

  const chatId = msg.chat.id;
  const link   = (match[1] || '').trim();

  if (!link) {
    return bot.sendMessage(chatId, '📌 Format: /idch <link_channel>');
  }

  const matchCode = link.match(/channel\/([A-Za-z0-9]+)/);
  const inviteCode = matchCode?.[1] || link;

  const proses = await bot.sendMessage(chatId, '🔍 Mengambil info channel...');

  try {
    const sock = readySessions.values().next().value;
    if (!sock) throw new Error('Tidak ada bot WA aktif');

    const meta = await sock.newsletterMetadata('invite', inviteCode);
    if (!meta?.id) throw new Error('Channel tidak ditemukan');

    const teks =
      `📢 *CHANNEL WHATSAPP*\n` +
      `━━━━━━━━━━━━━━━━━━━\n\n` +
      `📛 *Nama*        : ${meta.name || '-'}\n` +
      `🆔 *ID*          : \`${meta.id}\`\n` +
      `📝 *Deskripsi*   : ${meta.description || '-'}\n\n` +
      `👥 *Subscriber*  : ${meta.subscriberCount ?? meta.subscribers ?? '-'}\n` +
      `✅ *Verified*    : ${meta.verification === 'VERIFIED' ? 'Ya' : 'Tidak'}\n` +
      `📅 *Dibuat*      : ${meta.creationTime ? new Date(meta.creationTime * 1000).toLocaleString('id-ID') : '-'}\n\n` +
      `━━━━━━━━━━━━━━━━━━━\n` +
      `⚡ GrenTzy Bot`;

    await bot.editMessageText(teks, {
      chat_id: chatId,
      message_id: proses.message_id,
      parse_mode: 'Markdown'
    }).catch(async () => {
      await bot.sendMessage(chatId, teks, { parse_mode: 'Markdown' });
    });

  } catch (e) {
    await bot.editMessageText(`❌ Gagal: ${e.message}`, {
      chat_id: chatId, message_id: proses.message_id
    }).catch(async () => {
      await bot.sendMessage(chatId, `❌ Gagal: ${e.message}`);
    });
  }
});

bot.onText(/\/id/, (msg) => {
  if (!tgGuard(bot, msg, '/id')) return;

  const from = msg.from || {};
  const chat = msg.chat || {};

  const nama = [from.first_name, from.last_name].filter(Boolean).join(' ') || '-';

  bot.sendMessage(msg.chat.id,
`🆔 *INFO TELEGRAM*
━━━━━━━━━━━━━━━━━━━

👤 *USER*
├ ID       : \`${from.id || '-'}\`
├ Nama     : ${nama}
├ Username : ${from.username ? '@' + from.username : '-'}
├ Bahasa   : ${from.language_code || '-'}
└ Premium  : ${from.is_premium ? '✅ Ya' : '❌ Tidak'}

💬 *CHAT*
├ ID       : \`${chat.id || '-'}\`
├ Tipe     : ${chat.type || '-'}
├ Judul    : ${chat.title || '-'}
└ Username : ${chat.username ? '@' + chat.username : '-'}

📨 *MESSAGE*
├ ID       : \`${msg.message_id || '-'}\`
├ Thread   : \`${msg.message_thread_id || '-'}\`
└ Tanggal  : ${new Date((msg.date || 0) * 1000).toLocaleString('id-ID')}

━━━━━━━━━━━━━━━━━━━
⚡ GrenTzy Bot`,
    { parse_mode: 'Markdown' });
});
case cek id tele

bot.onText(/\/spotify(?:\s+(.+))?/, async (msg, match) => {
  if (!tgGuard(bot, msg, '/spotify')) return;

  const chatId = msg.chat.id;
  const query  = (match[1] || '').trim();

  if (!query) {
    return bot.sendMessage(chatId,
      `📌 Format: /spotify <judul atau link>\n\nContoh:\n/spotify Perfect Ed Sheeran\n/spotify https://open.spotify.com/track/xxx`);
  }

  const proses = await bot.sendMessage(chatId, `🎧 Mencari: ${query}...`);

  try {
    const apiUrl = `https://api.nexray.web.id/downloader/spotifyplay?q=${encodeURIComponent(query)}`;

    const { data } = await axios.get(apiUrl, {
      timeout: 60000,
      headers: { 'User-Agent': 'Mozilla/5.0' }
    });

    if (!data?.status || !data?.result) {
      throw new Error('Lagu tidak ditemukan');
    }

    const r = data.result;

    const title    = r.title    || 'Unknown';
    const artist   = r.artist   || r.artists || '-';
    const album    = r.album    || '-';
    const duration = r.duration || '-';
    const thumb    = r.thumbnail || r.image || null;
    const audio    = r.audio    || r.url || r.download || r.mp3 || r.link;

    if (!audio) {
      throw new Error('Link audio tidak tersedia');
    }

    const caption =
      `🎵 *SPOTIFY PLAY*\n` +
      `━━━━━━━━━━━━━━━━━━━\n\n` +
      `🎼 *Judul*   : ${title}\n` +
      `🎤 *Artist*  : ${artist}\n` +
      `💽 *Album*   : ${album}\n` +
      `⏱️ *Durasi*  : ${duration}\n\n` +
      `━━━━━━━━━━━━━━━━━━━\n` +
      `⚡ GrenTzy Bot`;

    if (thumb) {
      try {
        await bot.sendPhoto(chatId, thumb, {
          caption,
          parse_mode: 'Markdown'
        });
      } catch {
        await bot.sendMessage(chatId, caption, { parse_mode: 'Markdown' });
      }
    } else {
      await bot.sendMessage(chatId, caption, { parse_mode: 'Markdown' });
    }

    try { await bot.deleteMessage(chatId, proses.message_id); } catch {}

    try {
      await bot.sendAudio(chatId, audio, {
        caption: `🎵 ${artist} - ${title}`,
        title:   title,
        performer: artist,
        parse_mode: 'Markdown'
      });
    } catch (e) {
      try {
        await bot.sendAudio(chatId, { url: audio }, {
          title,
          performer: artist
        });
      } catch (e2) {
        await bot.sendMessage(chatId, `❌ Gagal kirim audio: ${e2.message}`);
      }
    }

    console.log(`🎵 [SPOTIFY] ${artist} - ${title}`);

  } catch (e) {
    console.error('❌ [SPOTIFY] Error:', e.message);

    await bot.editMessageText(
      `❌ *Gagal ambil lagu*\n\n` +
      `▸ Query: ${query}\n` +
      `▸ Error: ${e.message}\n\n` +
      `_Coba judul lain atau pakai link Spotify langsung._`,
      { chat_id: chatId, message_id: proses.message_id, parse_mode: 'Markdown' }
    ).catch(async () => {
      await bot.sendMessage(chatId, `❌ Gagal: ${e.message}`);
    });
  }
});

bot.onText(/\/cekuntele(?:\s+(.+))?/, async (msg, match) => {
  if (!tgGuard(bot, msg, '/cekuntele')) return;

  const chatId   = msg.chat.id;
  const username = (match[1] || '').trim().replace(/^@/, '');

  if (!username) {
    return bot.sendMessage(chatId,
      `📌 Format: /cekuntele <username>\n\nContoh:\n/cekuntele GrenTzy1`);
  }

  const proses = await bot.sendMessage(chatId,
    `🔍 Mencari @${username}...`);

  try {
    let user = null;

    try {
      const res = await axios.get(
        `https://t.me/${username}`,
        {
          timeout: 15000,
          headers: {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
          }
        }
      );

      const html = res.data || '';

      if (
        html.includes('tgme_page_title') ||
        html.includes('tgme_page_icon') ||
        html.includes('tgme_page_description')
      ) {
        const titleMatch = html.match(/<div class="tgme_page_title"[^>]*>[\s\S]*?<span[^>]*>([\s\S]*?)<\/span>/i)
                        || html.match(/<meta property="og:title" content="([^"]+)"/i);
        const descMatch  = html.match(/<div class="tgme_page_description[^"]*"[^>]*>([\s\S]*?)<\/div>/i)
                        || html.match(/<meta property="og:description" content="([^"]+)"/i);
        const imgMatch   = html.match(/<meta property="og:image" content="([^"]+)"/i);
        const extraMatch = html.match(/<div class="tgme_page_extra">([\s\S]*?)<\/div>/i);

        const clean = (s) =>
          String(s || '')
            .replace(/<br\s*\/?>/gi, '\n')
            .replace(/<[^>]+>/g, '')
            .replace(/&nbsp;/g, ' ')
            .replace(/&amp;/g, '&')
            .replace(/&quot;/g, '"')
            .replace(/&#39;/g, "'")
            .replace(/\s+\n/g, '\n')
            .trim();

        user = {
          title:  clean(titleMatch?.[1]),
          desc:   clean(descMatch?.[1]),
          image:  imgMatch?.[1] || null,
          extra:  clean(extraMatch?.[1]),
          isBot:  html.includes('bot') && /bot/i.test(clean(titleMatch?.[1]) || '')
        };
      }
    } catch (e) {
      console.error('Fetch error:', e.message);
    }

    if (!user || !user.title) {
      await bot.editMessageText(
        `❌ *Akun tidak ditemukan*\n\n` +
        `▸ Username: @${username}\n\n` +
        `_Cek ejaan username atau akun mungkin private._`,
        { chat_id: chatId, message_id: proses.message_id, parse_mode: 'Markdown' }
      ).catch(async () => {
        await bot.sendMessage(chatId, `❌ Akun @${username} tidak ditemukan.`);
      });
      return;
    }

    let teks =
      `👤 *TELEGRAM INFO*\n` +
      `━━━━━━━━━━━━━━━━━━━\n\n` +
      `🔖 Username : @${username}\n` +
      `📛 Nama     : ${user.title}\n`;

    if (user.extra) {
      teks += `📊 Info     : ${user.extra}\n`;
    }

    if (user.desc) {
      const desc = user.desc.length > 300
        ? user.desc.slice(0, 300) + '...'
        : user.desc;
      teks += `\n📝 *Bio:*\n${desc}\n`;
    }

    teks +=
      `\n━━━━━━━━━━━━━━━━━━━\n` +
      `🔗 t.me/${username}\n` +
      `⚡ GrenTzy Bot`;

    if (user.image) {
      try {
        await bot.sendPhoto(chatId, user.image, {
          caption: teks,
          parse_mode: 'Markdown'
        });
        try { await bot.deleteMessage(chatId, proses.message_id); } catch {}
        return;
      } catch {}
    }

    await bot.editMessageText(teks, {
      chat_id: chatId,
      message_id: proses.message_id,
      parse_mode: 'Markdown',
      disable_web_page_preview: false
    });

  } catch (e) {
    console.error('❌ [CEKUNTELE] Error:', e.message);
    await bot.editMessageText(`❌ Gagal cek: ${e.message}`, {
      chat_id: chatId, message_id: proses.message_id
    }).catch(async () => {
      await bot.sendMessage(chatId, `❌ Gagal: ${e.message}`);
    });
  }
});

bot.onText(/\/cekwa(?:\s+(.+))?/, async (msg, match) => {
  if (!tgGuard(bot, msg, '/cekwa')) return;

  const chatId = msg.chat.id;
  const input  = (match[1] || '').trim();

  if (!input) {
    return bot.sendMessage(chatId,
      `📌 Format: /cekwa <nomor>\n\nContoh:\n/cekwa 6283166964321`);
  }

  let nomor = input.replace(/[^0-9]/g, '');
  if (nomor.startsWith('0')) nomor = '62' + nomor.slice(1);
  else if (nomor.startsWith('8')) nomor = '62' + nomor;

  if (nomor.length < 8) {
    return bot.sendMessage(chatId, '❌ Nomor tidak valid.');
  }

  const proses = await bot.sendMessage(chatId, `🔍 Cek nomor: ${nomor}...`);

  try {
    const jid = nomor + '@s.whatsapp.net';

    const sock = readySessions.values().next().value;
    if (!sock) {
      throw new Error('Tidak ada bot WA yang aktif');
    }

    const [check] = await sock.onWhatsApp(jid);

    if (!check?.exists) {
      await bot.editMessageText(`❌ Nomor tidak terdaftar di WhatsApp\n\n📞 ${nomor}`, {
        chat_id: chatId, message_id: proses.message_id
      });
      return;
    }

    let ppUrl = null;
    try {
      ppUrl = await sock.profilePictureUrl(jid, 'image');
    } catch {}

    let status = null;
    try {
      const st = await sock.fetchStatus(jid);
      status = st?.status || null;
    } catch {}

    let business = null;
    try {
      business = await sock.getBusinessProfile(jid);
    } catch {}

    let teks =
      `📱 *WHATSAPP INFO*\n` +
      `━━━━━━━━━━━━━━━━━━━\n\n` +
      `📞 Nomor     : ${nomor}\n` +
      `🆔 JID       : ${check.jid || jid}\n` +
      `✅ Terdaftar : Ya\n`;

    if (status) teks += `📝 Status    : ${status}\n`;
    if (ppUrl)  teks += `🖼️ Foto Profil : Tersedia\n`;
    else        teks += `🖼️ Foto Profil : Tidak tersedia / private\n`;

    if (business) {
      teks += `\n🏢 *BUSINESS INFO*\n`;
      if (business.description) teks += `▸ Deskripsi : ${business.description}\n`;
      if (business.email)       teks += `▸ Email     : ${business.email}\n`;
      if (business.website)     teks += `▸ Website   : ${business.website}\n`;
      if (business.address)     teks += `▸ Alamat    : ${business.address}\n`;
      if (business.category)    teks += `▸ Kategori  : ${business.category}\n`;
      teks += `▸ Verified  : ${business.isVerified ? '✅ Ya' : '❌ Tidak'}\n`;
    } else {
      teks += `\n🏢 *BUSINESS INFO*\n▸ Bukan akun bisnis\n`;
    }

    teks += `\n━━━━━━━━━━━━━━━━━━━\n⚡ GrenTzy Bot`;

    if (ppUrl) {
      await bot.sendPhoto(chatId, ppUrl, { caption: teks, parse_mode: 'Markdown' })
        .then(() => bot.deleteMessage(chatId, proses.message_id))
        .catch(async () => {
          await bot.editMessageText(teks, {
            chat_id: chatId, message_id: proses.message_id, parse_mode: 'Markdown'
          });
        });
    } else {
      await bot.editMessageText(teks, {
        chat_id: chatId, message_id: proses.message_id, parse_mode: 'Markdown'
      });
    }

  } catch (e) {
    console.error('❌ [CEKWA] Error:', e.message);
    await bot.editMessageText(`❌ Gagal cek nomor: ${e.message}`, {
      chat_id: chatId, message_id: proses.message_id
    }).catch(async () => {
      await bot.sendMessage(chatId, `❌ Gagal: ${e.message}`);
    });
  }
});

bot.onText(/\/tourl(?:\s+(.+))?/, async (msg, match) => {
  if (!tgGuard(bot, msg, '/tourl')) return;

  const chatId = msg.chat.id;

  const replied = msg.reply_to_message;

  if (!replied || (!replied.photo && !replied.video && !replied.audio && !replied.voice && !replied.document && !replied.sticker && !replied.animation)) {
    return bot.sendMessage(chatId,
`📌 Format:
• Reply foto/video/audio/dokumen/sticker
• Ketik /tourl

_Upload ke catbox.moe → dapat link permanent_`);
  }

  const proses = await bot.sendMessage(chatId, '⏳ Mengupload ke catbox...');

  try {
    let fileId   = null;
    let fileName = null;
    let mime     = null;

    if (replied.photo) {
      const best = replied.photo[replied.photo.length - 1];
      fileId   = best.file_id;
      fileName = `grentzy_${Date.now()}.jpg`;
      mime     = 'image/jpeg';
    } else if (replied.video) {
      fileId   = replied.video.file_id;
      fileName = replied.video.file_name || `grentzy_${Date.now()}.mp4`;
      mime     = 'video/mp4';
    } else if (replied.audio) {
      fileId   = replied.audio.file_id;
      fileName = replied.audio.file_name || `grentzy_${Date.now()}.mp3`;
      mime     = replied.audio.mime_type || 'audio/mpeg';
    } else if (replied.voice) {
      fileId   = replied.voice.file_id;
      fileName = `grentzy_${Date.now()}.ogg`;
      mime     = 'audio/ogg';
    } else if (replied.document) {
      fileId   = replied.document.file_id;
      fileName = replied.document.file_name || `grentzy_${Date.now()}.bin`;
      mime     = replied.document.mime_type || 'application/octet-stream';
    } else if (replied.sticker) {
      fileId   = replied.sticker.file_id;
      fileName = `grentzy_${Date.now()}.webp`;
      mime     = 'image/webp';
    } else if (replied.animation) {
      fileId   = replied.animation.file_id;
      fileName = replied.animation.file_name || `grentzy_${Date.now()}.mp4`;
      mime     = 'video/mp4';
    }

    const fileLink = await bot.getFileLink(fileId);

    const fileRes = await axios.get(fileLink, {
      responseType: 'arraybuffer',
      timeout: 120000,
      maxContentLength: Infinity,
      maxBodyLength: Infinity
    });

    const buffer = Buffer.from(fileRes.data);

    if (!buffer || buffer.length === 0) {
      throw new Error('File gagal di-download');
    }

    const FormData = require('form-data');
    const form = new FormData();
    form.append('fileToUpload', buffer, { filename: fileName });
    form.append('reqtype', 'fileupload');

    const { data } = await axios.post(
      'https://catbox.moe/user/api.php',
      form,
      {
        headers: form.getHeaders(),
        timeout: 120000,
        maxContentLength: Infinity,
        maxBodyLength: Infinity
      }
    );

    const fileUrl = String(data).trim();

    if (!fileUrl.startsWith('http')) {
      throw new Error('Upload gagal: ' + fileUrl.slice(0, 100));
    }

    const sizeMB = (buffer.length / 1024 / 1024).toFixed(2);

    await bot.editMessageText(
`✅ UPLOAD BERHASIL
━━━━━━━━━━━━━━━━━━━

🔗 Link:
${fileUrl}

📊 Size: ${sizeMB} MB
📁 Nama: ${fileName}

_Link permanent, bebas expired_`,
      {
        chat_id: chatId,
        message_id: proses.message_id,
        disable_web_page_preview: true
      }
    ).catch(async () => {
      await bot.sendMessage(chatId, `✅ Link:\n${fileUrl}`, {
        disable_web_page_preview: true
      });
    });

    console.log(`📤 [TOURL] → ${fileUrl}`);

  } catch (e) {
    console.error('❌ [TOURL] Error:', e.message);

    await bot.editMessageText(
`❌ GAGAL UPLOAD

_Error: ${e.message}_

Kemungkinan:
• File terlalu besar (>200 MB)
• Telegram file expired
• Server catbox down`,
      { chat_id: chatId, message_id: proses.message_id }
    ).catch(async () => {
      await bot.sendMessage(chatId, `❌ Gagal upload: ${e.message}`);
    });
  }
});

bot.onText(/\/qr(?:\s+(.+))?/, async (msg, match) => {
  if (!tgGuard(bot, msg, '/qr')) return;

  const chatId = msg.chat.id;
  const text   = (match[1] || '').trim();

  if (text) {
    const qrUrl = `https://api.qrserver.com/v1/create-qr-code/?size=500x500&data=${encodeURIComponent(text)}`;

    const proses = await bot.sendMessage(chatId, '⏳ Membuat QR...');

    try {
      await bot.sendPhoto(chatId, qrUrl);
      try { await bot.deleteMessage(chatId, proses.message_id); } catch {}
    } catch (e) {
      try {
        await bot.editMessageText(`❌ Gagal buat QR: ${e.message}`, {
          chat_id: chatId, message_id: proses.message_id
        });
      } catch {
        bot.sendMessage(chatId, `❌ Gagal buat QR: ${e.message}`);
      }
    }
    return;
  }

  if (msg.reply_to_message?.photo) {
    const photos = msg.reply_to_message.photo;
    const best   = photos[photos.length - 1];

    const proses = await bot.sendMessage(chatId, '⏳ Mengubah foto jadi QR...');

    try {
      const fileLink = await bot.getFileLink(best.file_id);
      const qrUrl = `https://api.qrserver.com/v1/create-qr-code/?size=500x500&data=${encodeURIComponent(fileLink)}`;

      await bot.sendPhoto(chatId, qrUrl);
      try { await bot.deleteMessage(chatId, proses.message_id); } catch {}
    } catch (e) {
      try {
        await bot.editMessageText(`❌ Gagal konversi: ${e.message}`, {
          chat_id: chatId, message_id: proses.message_id
        });
      } catch {
        bot.sendMessage(chatId, `❌ Gagal konversi: ${e.message}`);
      }
    }
    return;
  }

  if (msg.reply_to_message?.sticker) {
    const sticker = msg.reply_to_message.sticker;

    const proses = await bot.sendMessage(chatId, '⏳ Mengubah sticker jadi QR...');

    try {
      const fileLink = await bot.getFileLink(sticker.file_id);
      const qrUrl = `https://api.qrserver.com/v1/create-qr-code/?size=500x500&data=${encodeURIComponent(fileLink)}`;

      await bot.sendPhoto(chatId, qrUrl);
      try { await bot.deleteMessage(chatId, proses.message_id); } catch {}
    } catch (e) {
      try {
        await bot.editMessageText(`❌ Gagal konversi: ${e.message}`, {
          chat_id: chatId, message_id: proses.message_id
        });
      } catch {
        bot.sendMessage(chatId, `❌ Gagal konversi: ${e.message}`);
      }
    }
    return;
  }

  if (msg.reply_to_message?.document) {
    const doc = msg.reply_to_message.document;

    const proses = await bot.sendMessage(chatId, '⏳ Mengubah dokumen jadi QR...');

    try {
      const fileLink = await bot.getFileLink(doc.file_id);
      const qrUrl = `https://api.qrserver.com/v1/create-qr-code/?size=500x500&data=${encodeURIComponent(fileLink)}`;

      await bot.sendPhoto(chatId, qrUrl);
      try { await bot.deleteMessage(chatId, proses.message_id); } catch {}
    } catch (e) {
      try {
        await bot.editMessageText(`❌ Gagal konversi: ${e.message}`, {
          chat_id: chatId, message_id: proses.message_id
        });
      } catch {
        bot.sendMessage(chatId, `❌ Gagal konversi: ${e.message}`);
      }
    }
    return;
  }

  bot.sendMessage(chatId, '📌 Format: /qr <text|url> atau reply foto/sticker/dokumen + /qr');
});