Reooiq96 commited on
Commit
5a114cd
·
verified ·
1 Parent(s): 5483748

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +61 -16
index.js CHANGED
@@ -2,47 +2,92 @@ const { WebcastPushConnection } = require('tiktok-live-connector');
2
  const axios = require('axios');
3
  const http = require('http');
4
 
5
- // جلب الإعدادات
6
  const { TELEGRAM_TOKEN, TELEGRAM_CHAT_ID, SESSION_ID, ACCOUNTS_LIST } = process.env;
7
  const ACCOUNTS = ACCOUNTS_LIST ? ACCOUNTS_LIST.split(',') : [];
8
 
 
 
 
9
  function startRadar(username) {
10
  let user = username.trim();
11
 
12
- // تعريف الاتصال المتوافق مع Node 18
13
  let connection = new WebcastPushConnection(user, {
14
  processInitialData: true,
15
  enableWebsocketUpgrade: true,
16
- sessionId: SESSION_ID
 
17
  });
18
 
19
  connection.connect().then(() => {
20
- console.log(`✅ متصل: ${user}`);
21
  }).catch(err => {
22
- console.log(`❌ خطأ في ${user}: ${err.message}`);
23
  setTimeout(() => startRadar(user), 15000);
24
  });
25
 
26
- // رادار الصناديق والحقائب
27
  connection.on('common', (data) => {
28
- // في الإصدارات الأقدم، كانت الحقائب تأتي تحت حدث 'common' أحياناً
29
- if (data.displayType && data.displayType.includes('box')) {
30
- console.log("صندوق محتمل ظهر!");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
  });
33
 
34
- // رادار الهدايا (الداعمين)
35
  connection.on('gift', (data) => {
36
- if (data.repeatEnd) {
37
- const msg = `🎁 <b>هدية جديدة!</b>\n👤 الداعم: ${data.nickname}\n💝 الهدية: ${data.giftName}\n💎 القيمة: ${data.diamondCount * data.repeatCount}`;
38
- axios.post(`https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage`, {
39
- chat_id: TELEGRAM_CHAT_ID, text: msg, parse_mode: 'HTML'
40
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
  });
43
 
44
  connection.on('disconnected', () => setTimeout(() => startRadar(user), 10000));
45
  }
46
 
 
 
 
 
 
 
 
 
 
47
  ACCOUNTS.forEach(user => startRadar(user));
48
- http.createServer((req, res) => res.end('Radar Stable Active')).listen(7860);
 
 
 
2
  const axios = require('axios');
3
  const http = require('http');
4
 
5
+ // جلب الإعدادات من Variables
6
  const { TELEGRAM_TOKEN, TELEGRAM_CHAT_ID, SESSION_ID, ACCOUNTS_LIST } = process.env;
7
  const ACCOUNTS = ACCOUNTS_LIST ? ACCOUNTS_LIST.split(',') : [];
8
 
9
+ // مخزن مراقبة السبام
10
+ let spamTracker = {};
11
+
12
  function startRadar(username) {
13
  let user = username.trim();
14
 
15
+ // إعداد الاتصال المتوافق مع Node 18
16
  let connection = new WebcastPushConnection(user, {
17
  processInitialData: true,
18
  enableWebsocketUpgrade: true,
19
+ sessionId: SESSION_ID,
20
+ clientParams: { "tt_target_idc": "useast1a" }
21
  });
22
 
23
  connection.connect().then(() => {
24
+ sendToTelegram(`🟢 <b>بدأ الرادار الشامل:</b> <code>${user}</code>`);
25
  }).catch(err => {
26
+ console.log(`❌ خطأ اتصال ${user}: ${err.message}`);
27
  setTimeout(() => startRadar(user), 15000);
28
  });
29
 
30
+ // 💰 1. رادار الحقائب والصناديق بكل أنواعها
31
  connection.on('common', (data) => {
32
+ if (data.displayType && (data.displayType.includes('box') || data.displayType.includes('envelope'))) {
33
+ sendToTelegram(`🎁 <b>ظهور كنز!</b>\n👤 الحساب: @${user}\n🔍 النوع: ${data.displayType}`);
34
+ }
35
+ });
36
+
37
+ // 👑 2. رادار المشرفين و VIP (لفل 40+)
38
+ connection.on('member', (data) => {
39
+ if (data.userLevel >= 40 || data.isModerator) {
40
+ const role = data.isModerator ? "مشرف 🛡️" : "VIP 👑";
41
+ sendToTelegram(`✨ <b>دخول ${role}:</b>\n👤 @${data.uniqueId} (Lvl ${data.userLevel})`);
42
+ }
43
+ });
44
+
45
+ // 🎤 3. رادار المشاهدات العالية (مؤشر الكيست القوي)
46
+ connection.on('roomUser', (data) => {
47
+ if (data.viewerCount > 5000) {
48
+ console.log(`مشاهدات عالية في بث ${user}: ${data.viewerCount}`);
49
  }
50
  });
51
 
52
+ // 🎁 4. رادار الداعمين (الهدايا التي تساوي 100 عملة فأكثر)
53
  connection.on('gift', (data) => {
54
+ if (data.diamondCount >= 100 && data.repeatEnd) {
55
+ sendToTelegram(`💎 <b>دعم قوي!</b>\n👤 الداعم: ${data.nickname}\n💝 الهدية: ${data.giftName} (x${data.repeatCount})`);
56
+ }
57
+ });
58
+
59
+ // 🛡️ 5. كاشف السبام (100 رسالة مطابقة في الدقيقة)
60
+ connection.on('chat', (data) => {
61
+ const msg = data.comment;
62
+ const now = Date.now();
63
+
64
+ if (!spamTracker[msg]) {
65
+ spamTracker[msg] = { count: 1, startTime: now };
66
+ } else {
67
+ if (now - spamTracker[msg].startTime < 60000) {
68
+ spamTracker[msg].count++;
69
+ if (spamTracker[msg].count === 100) {
70
+ sendToTelegram(`⚠️ <b>تحذير سبام (100 رسالة/دقيقة):</b>\n💬 النص: "${msg}"\n👤 الحساب: @${user}`);
71
+ }
72
+ } else {
73
+ spamTracker[msg] = { count: 1, startTime: now };
74
+ }
75
  }
76
  });
77
 
78
  connection.on('disconnected', () => setTimeout(() => startRadar(user), 10000));
79
  }
80
 
81
+ async function sendToTelegram(text) {
82
+ try {
83
+ await axios.post(`https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage`, {
84
+ chat_id: TELEGRAM_CHAT_ID, text: text, parse_mode: 'HTML'
85
+ });
86
+ } catch (e) { console.log("خطأ في إرسال التلجرام"); }
87
+ }
88
+
89
+ // تشغيل الرادار لكل الحسابات
90
  ACCOUNTS.forEach(user => startRadar(user));
91
+
92
+ // سيرفر بسيط لإبقاء الخدمة تعمل على Hugging Face
93
+ http.createServer((req, res) => res.end('Radar Mega V7 Online')).listen(7860);