(sock, message, args, context)
| 9 | description: 'Lookup phone number country, carrier and type', |
| 10 | usage: '.siminfo <phone number with country code>\nExample: .siminfo +923001234567', |
| 11 | async handler(sock, message, args, context) { |
| 12 | const { chatId, channelInfo } = context; |
| 13 | const input = args.join('').trim().replace(/\s+/g, ''); |
| 14 | if (!input) { |
| 15 | return await sock.sendMessage(chatId, { |
| 16 | text: `📱 *SIM / Phone Info*\n\n` + |
| 17 | `*Usage:* \`.siminfo <number>\`\n\n` + |
| 18 | `*Examples:*\n` + |
| 19 | `• \`.siminfo +923001234567\` — Pakistan\n` + |
| 20 | `• \`.siminfo +14155552671\` — USA\n` + |
| 21 | `• \`.siminfo +447911123456\` — UK\n` + |
| 22 | `• \`.siminfo +971501234567\` — UAE\n\n` + |
| 23 | `ℹ️ Include country code with or without +`, |
| 24 | ...channelInfo |
| 25 | }, { quoted: message }); |
| 26 | } |
| 27 | try { |
| 28 | const scriptPath = path.join(process.cwd(), 'lib', 'siminfo.py'); |
| 29 | const { stdout } = await execAsync(`python3 "${scriptPath}" "${input}"`, { timeout: 10000 }); |
| 30 | const data = JSON.parse(stdout.trim()); |
| 31 | if (data.error) { |
| 32 | return await sock.sendMessage(chatId, { |
| 33 | text: `❌ ${data.error}`, |
| 34 | ...channelInfo |
| 35 | }, { quoted: message }); |
| 36 | } |
| 37 | const validIcon = data.valid ? '✅' : '⚠️'; |
| 38 | const carrierLine = data.carrier !== 'Unknown' ? `\n📶 *Carrier:* ${data.carrier}` : ''; |
| 39 | await sock.sendMessage(chatId, { |
| 40 | text: `📱 *Phone Number Info*\n\n` + |
| 41 | `🔢 *Number:* ${data.number}\n` + |
| 42 | `${data.flag} *Country:* ${data.country}\n` + |
| 43 | `🌍 *Region:* ${data.region}\n` + |
| 44 | `🏷️ *Country Code:* ${data.country_code}\n` + |
| 45 | `📞 *National Number:* ${data.national_number}\n` + |
| 46 | `📡 *Line Type:* ${data.line_type}` + |
| 47 | `${carrierLine}\n` + |
| 48 | `${validIcon} *Valid:* ${data.valid ? 'Yes' : 'Possibly invalid (check length)'}`, |
| 49 | ...channelInfo |
| 50 | }, { quoted: message }); |
| 51 | } |
| 52 | catch (error) { |
| 53 | await sock.sendMessage(chatId, { |
| 54 | text: `❌ Lookup failed: ${error.message}`, |
| 55 | ...channelInfo |
| 56 | }, { quoted: message }); |
| 57 | } |
| 58 | } |
| 59 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected