(sock, message, args, context)
| 20 | description: 'Get location info from an IP or Domain', |
| 21 | usage: '.ip <address/domain>', |
| 22 | async handler(sock, message, args, context) { |
| 23 | const chatId = context.chatId || message.key.remoteJid; |
| 24 | const query = args[0]; |
| 25 | if (!query) |
| 26 | return await sock.sendMessage(chatId, { text: 'Enter an IP or Domain (e.g., google.com).' }); |
| 27 | try { |
| 28 | const res = await axios.get(`http://ip-api.com/json/${query}?fields=status,message,country,regionName,city,zip,isp,org,as,query`); |
| 29 | const data = res.data; |
| 30 | if (data.status === 'fail') |
| 31 | return await sock.sendMessage(chatId, { text: `❌ Error: ${data.message}` }); |
| 32 | const info = ` |
| 33 | 🌐 *IP/Domain Lookup* |
| 34 | --- |
| 35 | 📍 *Target:* ${data.query} |
| 36 | 🌍 *Country:* ${data.country} |
| 37 | 🏙️ *City/Region:* ${data.city}, ${data.regionName} |
| 38 | 📮 *Zip:* ${data.zip} |
| 39 | 📡 *ISP:* ${data.isp} |
| 40 | 🏢 *Organization:* ${data.org} |
| 41 | `.trim(); |
| 42 | await sock.sendMessage(chatId, { text: info }, { quoted: message }); |
| 43 | } |
| 44 | catch (err) { |
| 45 | await sock.sendMessage(chatId, { text: '❌ Network error.' }); |
| 46 | } |
| 47 | } |
| 48 | }; |
| 49 | /***************************************************************************** |
| 50 | * * |
nothing calls this directly
no outgoing calls
no test coverage detected