Update index.js
Browse files
index.js
CHANGED
|
@@ -58,51 +58,44 @@ function startRadar(username) {
|
|
| 58 |
clientParams: { "app_language": "ar-IQ", "device_platform": "web" }
|
| 59 |
});
|
| 60 |
|
| 61 |
-
|
| 62 |
-
let
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
| 90 |
});
|
| 91 |
|
| 92 |
-
// ๐ก๏ธ
|
| 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>
|
| 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> ู
ุดุงูุฏ!
|
| 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
|
| 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}
|
| 167 |
-
|
| 168 |
-
|
| 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 |
-
|
| 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 |
});
|