manafzz147/shenskyxfreegacha_botPublic · Bot Template
AIBot presents a numbered service menu for WhatsApp and Facebook with country selection through inline keyboards. It handles callback queries to edit the menu message, includes a /testreply debug command that reports whether the current message is a reply, and provides an /add command that parses service and country arguments and accepts phone numbers from a replied message or extra arguments. The flow is command-based and uses TeleBotHost built-ins like Api and Bot.
Utilitywhatsappfacebookinline-keyboardcallback-queryadd-numbersri-lanka
4 commands0 envUpdated 1d agoCreated Sep 3, 2026
commands/_add.js
javascript · 122 lines
1/**#command2name: /add3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12let parts = (message.text || "").split(/\s+/);13let service = (parts[1] || "").toLowerCase();14let country = (parts[2] || "").toLowerCase();15 16// Kalau gak ada service & country, coba ambil dari argumen lain17if (!service || !country) {18 // Coba parse: .add whatsapp_srilanka atau .add whatsapp-srilanka19 let arg = parts[1] || "";20 if (arg.includes("_") || arg.includes("-")) {21 let sep = arg.includes("_") ? "_" : "-";22 let sp = arg.split(sep);23 service = sp[0];24 country = sp[1];25 }26}27 28if (!service || !country) {29 Bot.sendMessage(30 "❌ *Format salah!*\\n\\n" +31 "Cara pakai (reply ke pesan nomor):\\n" +32 "`.add whatsapp srilanka`\\n\\n" +33 "Atau:\\n" +34 "`.add whatsapp_srilanka`",35 { parse_mode: "Markdown" }36 );37 return;38}39 40// Ambil nomor dari reply ATAU dari args sisanya41let inputText = "";42if (message.reply_to_message && message.reply_to_message.text) {43 inputText = message.reply_to_message.text;44} else if (parts.length > 3) {45 // .add whatsapp srilanka 08123456789,0812345679046 inputText = parts.slice(3).join(" ");47}48 49if (!inputText) {50 Bot.sendMessage(51 "❌ *Cara pakai:*\\n\\n" +52 "1️⃣ *Reply* ke pesan yang isi nomor, lalu ketik:\\n" +53 "`.add whatsapp srilanka`\\n\\n" +54 "2️⃣ Atau langsung:\\n" +55 "`.add whatsapp srilanka 08123456789,08123456790`",56 { parse_mode: "Markdown" }57 );58 return;59}60 61// ========== EXTRACT NOMOR ==========62let numbers = [];63let seen = new Set();64let lines = inputText.split(/[\n,]+/);65 66for (let raw of lines) {67 let line = raw.trim();68 if (!line) continue;69 70 // Skip baris yang jelas bukan nomor71 if (/country|batch|used|left|check|whatsapp|facebook|available|get your|select|service|total added|new numbers|🌍/i.test(line)) continue;72 73 // Hapus nomor urut di awal: "1. " "2) " "3- " "10. "74 line = line.replace(/^\d+[\.\)\-\s]+/, "");75 76 // Hapus tanda + di depan77 line = line.replace(/^\+/, "");78 79 // Ambil cuma angka80 let clean = line.replace(/[^\d]/g, "");81 82 // Validasi: 7-15 digit83 if (clean.length >= 7 && clean.length <= 15 && !seen.has(clean)) {84 seen.add(clean);85 numbers.push(clean);86 }87}88 89if (numbers.length === 0) {90 Bot.sendMessage(91 "❌ *Tidak ada nomor valid!*\\n\\n" +92 "Pastikan formatnya kayak gini:\\n" +93 "```\\n" +94 "1. +94781173945\\n" +95 "2. +94789334660\\n" +96 "3. +94727501892\\n" +97 "```",98 { parse_mode: "Markdown" }99 );100 return;101}102 103// Simpan ke pool104let poolKey = "pool_" + service + "_" + country;105let pool = await db.bot.get(poolKey, []);106let added = 0;107for (let num of numbers) {108 if (!pool.includes(num)) {109 pool.push(num);110 added++;111 }112}113await db.bot.set(poolKey, pool);114 115Bot.sendMessage(116 "✅ *" + added + "* nomor ditambahkan!\\n\\n" +117 "📱 Service: `" + service + "`\\n" +118 "🌍 Country: `" + country + "`\\n" +119 "📊 Total pool: `" + pool.length + "` nomor\\n\\n" +120 "Contoh: `+" + numbers[0] + "`",121 { parse_mode: "Markdown" }122);