manafzz147/Shenskyx_botPublic · Bot Template

ProfileTelegram

AIshen appears to be a Telegram automation bot. Commands include /start, /menu_edit_basic, /buyvps, /vps, /admin, /order_basic, /kirim_pair, /order_pro. Observed in code: messaging, keyboards.

Utilityutility
16 commands0 envUpdated 1mo agoCreated Sep 4, 2026
Back to folder

commands/_save_qr.js

javascript · 113 lines

Raw
1/**#command2name: /save_qr3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12if (request && request.id) {13  Api.answerCallbackQuery({ callback_query_id: request.id });14}15 16function fixHtml(text) {17  if (!text) return "";18  return String(text)19    .replace(/&/g, "&amp;")20    .replace(/</g, "&lt;")21    .replace(/>/g, "&gt;");22}23 24let keyStok = "stok_vps_basic";25let listStok = Bot.getProperty(keyStok) || [];26 27// 1. Cek Apakah Stok VPS Masih Ada28if (listStok.length === 0) {29  Api.sendMessage({30    text: "❌ <b>Maaf, Stok VPS Basic Saat Ini Sedang Kosong!</b>\n\nSilakan hubungi Admin untuk ketersediaan unit.",31    parse_mode: "HTML"32  });33  return;34}35 36// 2. Ambil VPS Paling Atas dari Stok37let vpsDiambil = listStok.shift(); // Mengambil dan menghapus 1 stok pertama38 39// Simpan sisa stok yang telah berkurang40Bot.setProperty(keyStok, listStok, "json");41 42// Update penggunaan kapasitas RAM & vCPU Global43let totalRam = Bot.getProperty("total_ram") || 32;44let totalVcpu = Bot.getProperty("total_vcpu") || 16;45let usedRam = (Bot.getProperty("used_ram") || 0) + 1; // Basic = +1 GB46let usedVcpu = (Bot.getProperty("used_vcpu") || 0) + 1; // Basic = +1 vCPU47 48Bot.setProperty("used_ram", usedRam, "integer");49Bot.setProperty("used_vcpu", usedVcpu, "integer");50 51// 3. Simpan Kredensial VPS ke Account User52let dataVpsUser = {53  plan: "VPS Basic (1 vCPU / 1 GB)",54  ip: vpsDiambil.ip,55  password: vpsDiambil.password56};57User.setProperty("has_vps", dataVpsUser, "json");58 59// 4. Kirimkan Detail VPS ke Pembeli60let teksSukses = "🎉 <b>PEMBAYARAN BERHASIL & VPS DITERIMA!</b>\n" +61                 "═══════════════════════\n\n" +62                 "Terima kasih telah berbelanja di <b>ShenSkyx Store</b>.\n" +63                 "Berikut kredensial akun VPS Anda:\n\n" +64                 "• Paket: <b>VPS Basic</b>\n" +65                 "• IP Address: <code>" + fixHtml(vpsDiambil.ip) + "</code>\n" +66                 "• Password: <code>" + fixHtml(vpsDiambil.password) + "</code>\n\n" +67                 "<i>Catatan: Kredensial ini dapat dicek kembali sewaktu-waktu pada menu Cek Status VPS.</i>";68 69let keyboard = {70  inline_keyboard: [71    [72      { text: "🖥️ Cek Status VPS Saya", callback_data: "/status_vps" }73    ],74    [75      { text: "🏠 Menu Utama", callback_data: "/start" }76    ]77  ]78};79 80if (request && request.message) {81  Api.editMessageText({82    message_id: request.message.message_id,83    text: teksSukses,84    parse_mode: 'HTML',85    reply_markup: keyboard86  });87} else {88  Api.sendMessage({89    text: teksSukses,90    parse_mode: 'HTML',91    reply_markup: keyboard92  });93}94 95// 5. Kirim Notifikasi Transaksi ke Admin96let ADMIN_ID = 123456789; // Ganti dengan ID Admin97let u = typeof user !== 'undefined' && user ? user : {};98let namaUser = fixHtml(u.first_name || "Pelanggan");99let usernameUser = u.username ? "@" + fixHtml(u.username) : "Tanpa Username";100 101let teksNotifAdmin = "⚡ <b>OTOMATIS: VPS BASIC TERJUAL</b>\n" +102                     "═══════════════════════\n\n" +103                     "• Pembeli: <b>" + namaUser + "</b> (" + usernameUser + ")\n" +104                     "• ID Telegram: <code>" + u.telegramid + "</code>\n" +105                     "• IP Terkirim: <code>" + fixHtml(vpsDiambil.ip) + "</code>\n" +106                     "• Sisa Stok Basic: <b>" + listStok.length + " unit</b>\n" +107                     "• Sisa RAM Server: <b>" + (totalRam - usedRam) + " GB</b>";108 109Api.sendMessage({110  chat_id: ADMIN_ID,111  text: teksNotifAdmin,112  parse_mode: 'HTML'113});