Reooiq96 commited on
Commit
a96c506
ยท
verified ยท
1 Parent(s): c397eb2

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +32 -66
index.js CHANGED
@@ -58,51 +58,44 @@ function startRadar(username) {
58
  clientParams: { "app_language": "ar-IQ", "device_platform": "web" }
59
  });
60
 
61
- // ู…ุชุบูŠุฑุงุช ุงู„ุฌู„ุณุฉ ู„ูƒู„ ุญุณุงุจ
62
- let highestHundred = 0;
63
- let maxViewers = 0;
64
- let totalLikes = 0;
65
- let totalShares = 0;
66
- let giftersMap = {};
67
- let commentersMap = {};
68
- let adminsSeen = new Set();
69
  let bestGift = { name: "ู„ุง ูŠูˆุฌุฏ", cost: 0, sender: "", icon: "" };
70
- let startTime = null;
71
- let likeMilestoneReached = false;
72
 
73
  connection.connect().then(state => {
74
  startTime = new Date();
75
- const liveLink = `https://www.tiktok.com/@${user}/live`;
76
  const userImage = state.roomInfo?.owner?.avatar_large?.url_list[0] || "";
77
-
78
- let msg = `๐Ÿ”ด <b>ุงู†ุทู„ุงู‚ ุงู„ุจุซ ุงู„ู…ุจุงุดุฑ</b>\n` +
79
- `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n` +
80
- `๐Ÿ‘ค <b>ุงู„ุญุณุงุจ:</b> <code>${user}</code>\n` +
81
- `๐ŸŒ <b>ุงู„ุฏูˆู„ุฉ:</b> ${FIXED_COUNTRY}\n` +
82
- `๐Ÿ“… <b>ุงู„ูˆู‚ุช :</b> <code>${getBaghdadTime()}</code>\n` +
83
- `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n` +
84
- `โœจ <b>ุงุถุบุท ุนู„ู‰ ุงู„ุตูˆุฑุฉ ู„ู„ุฏุฎูˆู„ ู…ุจุงุดุฑุฉ</b>\n` +
85
- `๐Ÿ”— <b>ุงู„ุฑุงุจุท:</b> <a href="${liveLink}">${liveLink}</a>`;
86
 
 
 
 
 
 
 
 
 
87
  sendToTelegram(msg, userImage, liveLink);
88
- }).catch(err => {
89
- setTimeout(() => startRadar(user), 60000);
 
 
 
90
  });
91
 
92
- // ๐Ÿ›ก๏ธ ุฏุฎูˆู„ ุงู„ู…ุดุฑููŠู† ูˆ VIP
93
  connection.on('member', (data) => {
94
  if (data.isModerator && !adminsSeen.has(data.uniqueId)) {
95
  adminsSeen.add(data.uniqueId);
96
  sendToTelegram(`๐Ÿ›ก๏ธ <b>ุญุถุฑ ู…ุดุฑู ููŠ ุจุซ @${user}:</b>\n๐Ÿ‘ค ุงู„ุญุณุงุจ: <code>@${data.uniqueId}</code>\n๐Ÿ“ ุงู„ุงุณู…: <b>${data.nickname}</b>`);
97
  }
98
- if (data.userLevel >= 40) {
99
- sendToTelegram(`๐Ÿ‘‘ <b>ุฏุฎูˆู„ ุฏุงุนู… VIP (Lvl ${data.userLevel})</b>\n๐Ÿ‘ค ููŠ ุจุซ: <code>@${user}</code>\n๐Ÿ‘ค ุงู„ุญุณุงุจ: <code>@${data.uniqueId}</code>`);
100
- }
101
  });
102
 
103
- // ๐ŸŽ ุงู„ุตู†ุงุฏูŠู‚
104
  connection.on('envelope', (data) => {
105
- sendToTelegram(`๐ŸŽ <b>ุชู†ุจูŠู‡ ุตู†ุฏูˆู‚ ุนู…ู„ุงุช!</b>\n๐Ÿ‘ค ููŠ ุจุซ: <code>@${user}</code>\n๐Ÿ’ฐ ุงู„ู…ุฑุณู„: <b>${data.nickname}</b>`);
106
  });
107
 
108
  // ๐Ÿš€ ุงู„ุฅู†ุฌุงุฒุงุช
@@ -112,11 +105,10 @@ function startRadar(username) {
112
  let currentHundred = Math.floor(viewers / 100) * 100;
113
  if (currentHundred >= 100 && currentHundred > highestHundred) {
114
  highestHundred = currentHundred;
115
- sendToTelegram(`๐Ÿš€ <b>ุฅู†ุฌุงุฒ @${user}:</b> ูˆุตู„ ุงู„ุขู† <code>${formatK(currentHundred)}</code> ู…ุดุงู‡ุฏ!\n๐Ÿ”— <a href="https://www.tiktok.com/@${user}/live">ุฑุงุจุท ุงู„ุจุซ</a>`);
116
  }
117
  });
118
 
119
- // ๐Ÿ’ฌ ุงู„ุชุนู„ูŠู‚ุงุช ูˆุงู„ุชูƒุจูŠุณ
120
  connection.on('chat', (data) => {
121
  if (!commentersMap[data.userId]) commentersMap[data.userId] = { name: data.nickname, count: 0 };
122
  commentersMap[data.userId].count++;
@@ -126,64 +118,38 @@ function startRadar(username) {
126
  totalLikes = data.totalLikeCount;
127
  if (totalLikes >= 300000 && !likeMilestoneReached) {
128
  likeMilestoneReached = true;
129
- sendToTelegram(`๐Ÿ”ฅ <b>ุฒู„ุฒุงู„ ุชูƒุจูŠุณ ุนู†ุฏ @${user}!</b>\nุชู… ูƒุณุฑ ุญุงุฌุฒ ุงู„ู€ <b>300K</b> ุฅุนุฌุงุจ!`);
130
  }
131
  });
132
 
133
- // ๐Ÿ’Ž ุงู„ู‡ุฏุงูŠุง ูˆุงู„ู…ุดุงุฑูƒุงุช
134
  connection.on('gift', (data) => {
135
  if (data.giftType === 1 && !data.repeatEnd) return;
136
  let giftCost = data.diamondCount * data.repeatCount;
137
  if (!giftersMap[data.userId]) giftersMap[data.userId] = { name: data.nickname, coins: 0 };
138
  giftersMap[data.userId].coins += giftCost;
139
- if (giftCost > bestGift.cost) {
140
- bestGift = { name: data.giftName, cost: giftCost, sender: data.nickname, icon: data.giftPictureUrl };
141
- }
142
  });
143
 
144
- connection.on('social', (data) => {
145
- if (data.displayType === 'pm_mt_guidance_share') totalShares++;
146
- });
147
 
148
- // ๐Ÿ ุชู‚ุฑูŠุฑ ุงู„ู†ู‡ุงูŠุฉ ุงู„ุดุงู…ู„
149
  connection.on('disconnected', () => {
150
  const durationStr = startTime ? `${Math.floor((new Date() - startTime) / 60000)} ุฏู‚ูŠู‚ุฉ` : "ุบูŠุฑ ู…ุญุฏุฏ";
151
- const liveLink = `https://www.tiktok.com/@${user}/live`;
152
  let sortedGifters = Object.values(giftersMap).sort((a, b) => b.coins - a.coins).slice(0, 3);
153
  let sortedCommenters = Object.values(commentersMap).sort((a, b) => b.count - a.count).slice(0, 5);
154
 
155
- let endMsg = `๐Ÿ <b>ู…ู„ุฎุต ู†ู‡ุงูŠุฉ ุงู„ุจุซ ุงู„ุดุงู…ู„ (@${user})</b>\n` +
156
- `โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n` +
157
- `โฑ๏ธ <b>ุงู„ู…ุฏุฉ:</b> ${durationStr} | ๐Ÿ“… <b>ุงู„ูˆู‚ุช:</b> ${getBaghdadTime()}\n` +
158
- `๐Ÿ“Š <b>ุงู„ุฅุญุตุงุฆูŠุงุช:</b>\n` +
159
- `๐Ÿ‘๏ธ ู…ุดุงู‡ุฏุฉ: <code>${formatK(maxViewers)}</code> | โค๏ธ ุฅุนุฌุงุจ: <code>${formatK(totalLikes)}</code>\n` +
160
- `๐Ÿ”„ ู…ุดุงุฑูƒุฉ: <code>${formatK(totalShares)}</code>\n\n` +
161
- `๐Ÿ† <b>ุฃูุถู„ 3 ุฏุงุนู…ูŠู†:</b>\n`;
162
-
163
  sortedGifters.forEach((g, i) => endMsg += `${i === 0 ? '๐Ÿฅ‡' : i === 1 ? '๐Ÿฅˆ' : '๐Ÿฅ‰'} <code>${g.name}</code> : <b>${formatK(g.coins)}</b>\n`);
164
-
165
  endMsg += `\n๐Ÿ’ฌ <b>ุฃูƒุซุฑ 5 ู…ุนู„ู‚ูŠู† ุชูุงุนู„ุงู‹:</b>\n`;
166
- sortedCommenters.forEach((c, i) => endMsg += `${i+1}. <code>${c.name}</code> (${c.count} ุชุนู„ูŠู‚)\n`);
167
-
168
- if (bestGift.cost > 0) {
169
- endMsg += `\n๐Ÿ’Ž <b>ุฃู‚ูˆู‰ ู‡ุฏูŠุฉ ูˆุตู„ุช:</b>\n๐Ÿ“ฆ ุงู„ู‡ุฏูŠุฉ: <b>${bestGift.name}</b>\n๐Ÿ‘ค ุงู„ู…ุฑุณู„: <code>${bestGift.sender}</code>\n\n` +
170
- `โœจ <b>ุงุถุบุท ุนู„ู‰ ุตูˆุฑุฉ ุงู„ู‡ุฏูŠุฉ ู„ู„ุฏุฎูˆู„ ู„ู„ุจุซ</b>`;
171
- }
172
-
173
- sendToTelegram(endMsg, bestGift.icon || null, liveLink);
174
  setTimeout(() => startRadar(user), 30000);
175
  });
176
  }
177
 
178
- // ุชุดุบูŠู„ ุงู„ุฑุงุฏุงุฑ
179
- if (ACCOUNTS_TO_WATCH.length > 0) {
180
- ACCOUNTS_TO_WATCH.forEach(user => startRadar(user));
181
- }
182
 
183
- // --- ู†ุธุงู… ุงู„ู†ุจุถ (Keep Alive) ---
184
- const server = http.createServer((req, res) => res.end('Radar Master Ultra Final ๐Ÿš€'));
185
  server.listen(7860, '0.0.0.0', () => {
186
- setInterval(() => {
187
- http.get(`http://localhost:7860`, () => {}).on('error', () => {});
188
- }, 240000);
189
  });
 
58
  clientParams: { "app_language": "ar-IQ", "device_platform": "web" }
59
  });
60
 
61
+ let highestHundred = 0, maxViewers = 0, totalLikes = 0, totalShares = 0;
62
+ let giftersMap = {}, commentersMap = {}, adminsSeen = new Set();
 
 
 
 
 
 
63
  let bestGift = { name: "ู„ุง ูŠูˆุฌุฏ", cost: 0, sender: "", icon: "" };
64
+ let startTime = null, likeMilestoneReached = false;
 
65
 
66
  connection.connect().then(state => {
67
  startTime = new Date();
 
68
  const userImage = state.roomInfo?.owner?.avatar_large?.url_list[0] || "";
69
+ let statusEmoji = "๐Ÿ”ด", statusText = "ุงู†ุทู„ุงู‚ ุงู„ุจุซ ุงู„ู…ุจุงุดุฑ", liveLink = `https://www.tiktok.com/@${user}/live`;
 
 
 
 
 
 
 
 
70
 
71
+ if (state.roomInfo.live_room_mode === 4) {
72
+ statusEmoji = "๐ŸŽค"; statusText = "ุชู†ุจูŠู‡: ุตุงุนุฏ ุฌูŠุณุช ุงู„ุขู†!";
73
+ if (state.roomInfo.owner && state.roomInfo.owner.uniqueId) {
74
+ liveLink = `https://www.tiktok.com/@${state.roomInfo.owner.uniqueId}/live`;
75
+ }
76
+ }
77
+
78
+ let msg = `${statusEmoji} <b>${statusText}</b>\nโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n๐Ÿ‘ค <b>ุงู„ุญุณุงุจ:</b> <code>${user}</code>\n๐ŸŒ <b>ุงู„ุฏูˆู„ุฉ:</b> ${FIXED_COUNTRY}\n๐Ÿ“… <b>ุงู„ูˆู‚ุช :</b> <code>${getBaghdadTime()}</code>\nโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\nโœจ <b>ุงุถุบุท ุนู„ู‰ ุงู„ุตูˆุฑุฉ ู„ู„ุฏุฎูˆู„</b>\n๐Ÿ”— <a href="${liveLink}">ุฑุงุจุท ุงู„ุจุซ ุงู„ู…ุจุงุดุฑ</a>`;
79
  sendToTelegram(msg, userImage, liveLink);
80
+ }).catch(err => setTimeout(() => startRadar(user), 60000));
81
+
82
+ // --- ๐Ÿ’ฐ [ุฑุงุฏุงุฑ ุงู„ุญู‚ูŠุจุฉ Treasure Box] ---
83
+ connection.on('treasureBox', (data) => {
84
+ sendToTelegram(`๐Ÿ’ฐ <b>ุชู†ุจูŠู‡ ุญู‚ูŠุจุฉ ุนู…ู„ุงุช!</b>\n๐Ÿ‘ค ููŠ ุจุซ: <code>@${user}</code>\n๐ŸŽ ุงู„ู…ุฑุณู„: <b>${data.nickname}</b>\n๐Ÿ’Ž ุงู„ู‚ูŠู…ุฉ: <b>${data.coins} ุนู…ู„ุฉ</b>\nโณ ุชุฑู‚ุจูˆุง ุงู„ูุชุญ ู‚ุฑูŠุจุงู‹!`);
85
  });
86
 
87
+ // ๐Ÿ›ก๏ธ ุงู„ู…ุดุฑููŠู† ูˆ VIP
88
  connection.on('member', (data) => {
89
  if (data.isModerator && !adminsSeen.has(data.uniqueId)) {
90
  adminsSeen.add(data.uniqueId);
91
  sendToTelegram(`๐Ÿ›ก๏ธ <b>ุญุถุฑ ู…ุดุฑู ููŠ ุจุซ @${user}:</b>\n๐Ÿ‘ค ุงู„ุญุณุงุจ: <code>@${data.uniqueId}</code>\n๐Ÿ“ ุงู„ุงุณู…: <b>${data.nickname}</b>`);
92
  }
93
+ if (data.userLevel >= 40) sendToTelegram(`๐Ÿ‘‘ <b>VIP (Lvl ${data.userLevel}) ุฏุฎู„ ุจุซ @${user}</b>`);
 
 
94
  });
95
 
96
+ // ๐ŸŽ ุงู„ุตู†ุงุฏูŠู‚ ุงู„ุนุงุฏูŠุฉ
97
  connection.on('envelope', (data) => {
98
+ sendToTelegram(`๐ŸŽ <b>ุตู†ุฏูˆู‚ ุนู…ู„ุงุช!</b>\n๐Ÿ‘ค ููŠ ุจุซ: <code>@${user}</code>\n๐Ÿ’ฐ ุงู„ู…ุฑุณู„: <b>${data.nickname}</b>`);
99
  });
100
 
101
  // ๐Ÿš€ ุงู„ุฅู†ุฌุงุฒุงุช
 
105
  let currentHundred = Math.floor(viewers / 100) * 100;
106
  if (currentHundred >= 100 && currentHundred > highestHundred) {
107
  highestHundred = currentHundred;
108
+ sendToTelegram(`๐Ÿš€ <b>ุฅู†ุฌุงุฒ @${user}:</b> ูˆุตู„ ุงู„ุขู† <code>${formatK(currentHundred)}</code> ู…ุดุงู‡ุฏ!`);
109
  }
110
  });
111
 
 
112
  connection.on('chat', (data) => {
113
  if (!commentersMap[data.userId]) commentersMap[data.userId] = { name: data.nickname, count: 0 };
114
  commentersMap[data.userId].count++;
 
118
  totalLikes = data.totalLikeCount;
119
  if (totalLikes >= 300000 && !likeMilestoneReached) {
120
  likeMilestoneReached = true;
121
+ sendToTelegram(`๐Ÿ”ฅ <b>ุฒู„ุฒุงู„ ุชูƒุจูŠุณ ุนู†ุฏ @${user}!</b>\nูƒุณุฑ ุญุงุฌุฒ ุงู„ู€ <b>300K</b> ุฅุนุฌุงุจ!`);
122
  }
123
  });
124
 
 
125
  connection.on('gift', (data) => {
126
  if (data.giftType === 1 && !data.repeatEnd) return;
127
  let giftCost = data.diamondCount * data.repeatCount;
128
  if (!giftersMap[data.userId]) giftersMap[data.userId] = { name: data.nickname, coins: 0 };
129
  giftersMap[data.userId].coins += giftCost;
130
+ if (giftCost > bestGift.cost) bestGift = { name: data.giftName, cost: giftCost, sender: data.nickname, icon: data.giftPictureUrl };
 
 
131
  });
132
 
133
+ connection.on('social', (data) => { if (data.displayType === 'pm_mt_guidance_share') totalShares++; });
 
 
134
 
 
135
  connection.on('disconnected', () => {
136
  const durationStr = startTime ? `${Math.floor((new Date() - startTime) / 60000)} ุฏู‚ูŠู‚ุฉ` : "ุบูŠุฑ ู…ุญุฏุฏ";
 
137
  let sortedGifters = Object.values(giftersMap).sort((a, b) => b.coins - a.coins).slice(0, 3);
138
  let sortedCommenters = Object.values(commentersMap).sort((a, b) => b.count - a.count).slice(0, 5);
139
 
140
+ let endMsg = `๐Ÿ <b>ู…ู„ุฎุต ู†ู‡ุงูŠุฉ ุงู„ุจุซ ุงู„ุดุงู…ู„ (@${user})</b>\nโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\nโฑ๏ธ <b>ุงู„ู…ุฏุฉ:</b> ${durationStr} | ๐Ÿ“… <b>ุงู„ูˆู‚ุช:</b> ${getBaghdadTime()}\n๐Ÿ“Š ๐Ÿ‘๏ธ ${formatK(maxViewers)} | โค๏ธ ${formatK(totalLikes)} | ๐Ÿ”„ ${totalShares}\n\n๐Ÿ† <b>ุฃูุถู„ 3 ุฏุงุนู…ูŠู†:</b>\n`;
 
 
 
 
 
 
 
141
  sortedGifters.forEach((g, i) => endMsg += `${i === 0 ? '๐Ÿฅ‡' : i === 1 ? '๐Ÿฅˆ' : '๐Ÿฅ‰'} <code>${g.name}</code> : <b>${formatK(g.coins)}</b>\n`);
 
142
  endMsg += `\n๐Ÿ’ฌ <b>ุฃูƒุซุฑ 5 ู…ุนู„ู‚ูŠู† ุชูุงุนู„ุงู‹:</b>\n`;
143
+ sortedCommenters.forEach((c, i) => endMsg += `${i+1}. <code>${c.name}</code> (${c.count})\n`;
144
+ if (bestGift.cost > 0) endMsg += `\n๐Ÿ’Ž <b>ุฃู‚ูˆู‰ ู‡ุฏูŠุฉ:</b> ${bestGift.name} ู…ู† <b>${bestGift.sender}</b>`;
145
+ sendToTelegram(endMsg, bestGift.icon || null, `https://www.tiktok.com/@${user}/live`);
 
 
 
 
 
146
  setTimeout(() => startRadar(user), 30000);
147
  });
148
  }
149
 
150
+ if (ACCOUNTS_TO_WATCH.length > 0) ACCOUNTS_TO_WATCH.forEach(user => startRadar(user));
 
 
 
151
 
152
+ const server = http.createServer((req, res) => res.end('Radar Mega Final with Treasure Box ๐Ÿš€'));
 
153
  server.listen(7860, '0.0.0.0', () => {
154
+ setInterval(() => { http.get(`http://localhost:7860`, () => {}).on('error', () => {}); }, 240000);
 
 
155
  });