Update index.js
Browse files
index.js
CHANGED
|
@@ -1,332 +1,162 @@
|
|
| 1 |
const { WebcastPushConnection } = require('tiktok-live-connector');
|
| 2 |
const axios = require('axios');
|
| 3 |
-
const dns = require('dns');
|
| 4 |
-
const http = require('http');
|
| 5 |
|
| 6 |
// --- ุฅุนุฏุงุฏุงุช ุงููุธุงู
---
|
| 7 |
-
const
|
| 8 |
-
const
|
| 9 |
-
const
|
| 10 |
-
const FIXED_COUNTRY = "ุงูุนุฑุงู ๐ฎ๐ถ";
|
| 11 |
-
const ACCOUNTS_TO_WATCH = process.env.ACCOUNTS_LIST ? process.env.ACCOUNTS_LIST.split(',') : [];
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
}
|
| 21 |
|
|
|
|
| 22 |
function getBaghdadTime() {
|
| 23 |
-
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
function formatDuration(totalMinutes) {
|
| 27 |
-
if (totalMinutes < 60) return `${totalMinutes} ุฏูููุฉ`;
|
| 28 |
-
const hours = Math.floor(totalMinutes / 60);
|
| 29 |
-
const minutes = totalMinutes % 60;
|
| 30 |
-
return minutes > 0 ? `${hours} ุณุงุนุฉ ู ${minutes} ุฏูููุฉ` : `${hours} ุณุงุนุฉ`;
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
// --- ุฅุฑุณุงู ุชูุฌุฑุงู
---
|
| 34 |
-
async function sendToTelegram(text, photoUrl = null, targetLink = null) {
|
| 35 |
-
try {
|
| 36 |
-
const addrs = await new Promise(r => dns.resolve4('api.telegram.org', (e, a) => r(a)));
|
| 37 |
-
const baseUrl = `https://${addrs[0]}/bot${TELEGRAM_TOKEN}`;
|
| 38 |
-
|
| 39 |
-
let formattedText = targetLink ? `<a href="${targetLink}">โโโ โ</a>` + text : text;
|
| 40 |
-
const payload = { chat_id: TELEGRAM_CHAT_ID, parse_mode: 'HTML', disable_web_page_preview: false };
|
| 41 |
-
|
| 42 |
-
if (photoUrl) {
|
| 43 |
-
payload.photo = photoUrl;
|
| 44 |
-
payload.caption = formattedText;
|
| 45 |
-
await axios.post(`${baseUrl}/sendPhoto`, payload, { headers: { 'Host': 'api.telegram.org' } });
|
| 46 |
-
} else {
|
| 47 |
-
payload.text = formattedText;
|
| 48 |
-
await axios.post(`${baseUrl}/sendMessage`, payload, { headers: { 'Host': 'api.telegram.org' } });
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
} catch (e) {
|
| 52 |
-
console.log("โ ๏ธ ุฎุทุฃ ุชูุฌุฑุงู
");
|
| 53 |
-
}
|
| 54 |
}
|
| 55 |
|
| 56 |
-
// --- ุงูุฑุงุฏุงุฑ ---
|
| 57 |
-
async function startRadar(
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
const primaryOptions = {
|
| 61 |
-
processInitialData: true,
|
| 62 |
-
enableWebsocketUpgrade: true,
|
| 63 |
-
sessionId: SESSION_ID,
|
| 64 |
-
clientParams: {
|
| 65 |
-
"app_language": "ar-IQ",
|
| 66 |
-
"device_platform": "web",
|
| 67 |
-
"tt_target_idc": "useast1a"
|
| 68 |
-
}
|
| 69 |
-
};
|
| 70 |
-
|
| 71 |
-
const fallbackOptions = {
|
| 72 |
-
processInitialData: true,
|
| 73 |
-
enableWebsocketUpgrade: true,
|
| 74 |
-
sessionId: SESSION_ID,
|
| 75 |
-
clientParams: {
|
| 76 |
-
"app_language": "ar-IQ",
|
| 77 |
-
"device_platform": "web"
|
| 78 |
-
}
|
| 79 |
-
};
|
| 80 |
-
|
| 81 |
-
let connection = new WebcastPushConnection(user, primaryOptions);
|
| 82 |
-
|
| 83 |
-
let highestHundred = 0, maxViewers = 0, totalLikes = 0, totalShares = 0;
|
| 84 |
-
let giftersMap = {}, commentersMap = {};
|
| 85 |
-
let adminsSeen = new Set();
|
| 86 |
-
let bestGift = { name: "ูุง ููุฌุฏ", cost: 0, sender: "", icon: "" };
|
| 87 |
-
let startTime = null;
|
| 88 |
-
let fastCommentCounter = {};
|
| 89 |
-
let alertedComments = new Set();
|
| 90 |
-
|
| 91 |
-
try {
|
| 92 |
-
const state = await connection.connect();
|
| 93 |
-
handleConnectionSuccess(state);
|
| 94 |
-
} catch (err) {
|
| 95 |
-
console.log(`โ ๏ธ ูุดู ุงูุงุชุตุงู ุงูุฃุณุงุณู ูู ${user}ุ ู
ุญุงููุฉ ุงูุงุชุตุงู ุงูุงุญุชูุงุทู...`);
|
| 96 |
-
connection = new WebcastPushConnection(user, fallbackOptions);
|
| 97 |
|
|
|
|
| 98 |
try {
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
} catch (fallbackErr) {
|
| 102 |
-
console.log(`โ ูุดู ุงูุงุชุตุงู ุงูุงุญุชูุงุทู ุฃูุถุงู ูู ${user}`);
|
| 103 |
-
setTimeout(() => startRadar(user), 60000);
|
| 104 |
-
return;
|
| 105 |
-
}
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
// ุนูุฏ ูุฌุงุญ ๏ฟฝ๏ฟฝูุงุชุตุงู
|
| 109 |
-
function handleConnectionSuccess(state) {
|
| 110 |
-
startTime = new Date();
|
| 111 |
-
|
| 112 |
-
let statusEmoji = state.roomInfo.live_room_mode === 4 ? "๐ค" : "๐ด";
|
| 113 |
-
let statusText = state.roomInfo.live_room_mode === 4 ? "ุชูุจูู: ุตุงุนุฏ ุฌูุณุช ุงูุขู!" : "ุงูุทูุงู ุงูุจุซ ุงูู
ุจุงุดุฑ";
|
| 114 |
-
|
| 115 |
-
let liveLink = `https://www.tiktok.com/@${user}/live`;
|
| 116 |
-
|
| 117 |
-
let msg = `${statusEmoji} <b>${statusText}</b>\n` +
|
| 118 |
-
`โโโโโโโโโโโโโโโโโ\n` +
|
| 119 |
-
`๐ค <b>ุงูุญุณุงุจ:</b> <code>${user}</code>\n` +
|
| 120 |
-
`๐ <b>ุงูุฏููุฉ:</b> ${FIXED_COUNTRY}\n` +
|
| 121 |
-
`๐
<b>ุงูููุช:</b> <code>${getBaghdadTime()}</code>\n` +
|
| 122 |
-
`โโโโโโโโโโโโโโโโโ\n` +
|
| 123 |
-
`๐ <b>ุฑุงุจุท ุงูุจุซ:</b> <a href="${liveLink}">${liveLink}</a>`;
|
| 124 |
-
|
| 125 |
-
sendToTelegram(msg);
|
| 126 |
-
}
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
-
|
| 133 |
-
const handleBox = (data, type) => {
|
| 134 |
-
let coins =
|
| 135 |
-
data.coins ||
|
| 136 |
-
data.diamonds ||
|
| 137 |
-
data.amount ||
|
| 138 |
-
(data.boxInfo && data.boxInfo.rewardDiamond) ||
|
| 139 |
-
data.rewardAmount ||
|
| 140 |
-
"ุบูุฑ ู
ุญุฏุฏ";
|
| 141 |
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
(data.user && data.user.nickname) ||
|
| 145 |
-
"ู
ุฌููู";
|
| 146 |
-
|
| 147 |
-
sendToTelegram(
|
| 148 |
-
`๐ฐ <b>ุชูุจูู ${type}!</b>\n๐ค ูู ุจุซ: @${user}\n๐ ู
ู: <b>${sender}</b>\n๐ ุงูููู
ุฉ: <b>${coins} ุนู
ูุฉ</b>`
|
| 149 |
-
);
|
| 150 |
-
};
|
| 151 |
-
|
| 152 |
-
connection.on('treasureBox', d => handleBox(d, "ุญููุจุฉ ุนู
ูุงุช"));
|
| 153 |
-
connection.on('luckyBox', d => handleBox(d, "ุตูุฏูู ุญุธ"));
|
| 154 |
-
connection.on('chest', d => handleBox(d, "ููุณุช"));
|
| 155 |
-
connection.on('chestStart', d => handleBox(d, "ููุณุช ุจุฏุฃ"));
|
| 156 |
-
connection.on('chestUpdate', d => handleBox(d, "ููุณุช ูุชุญุฏุซ"));
|
| 157 |
-
connection.on('chestEnd', d => handleBox(d, "ููุณุช ุงูุชูู"));
|
| 158 |
-
|
| 159 |
-
// --- ุชุนูููุงุช + ุณุจุงู
---
|
| 160 |
-
connection.on('chat', (data) => {
|
| 161 |
-
let text = data.comment.trim();
|
| 162 |
-
let now = Date.now();
|
| 163 |
-
|
| 164 |
-
if (!commentersMap[data.userId])
|
| 165 |
-
commentersMap[data.userId] = { name: data.nickname, count: 0 };
|
| 166 |
-
commentersMap[data.userId].count++;
|
| 167 |
-
|
| 168 |
-
if (text.length > 1) {
|
| 169 |
-
if (!fastCommentCounter[text]) fastCommentCounter[text] = [];
|
| 170 |
-
fastCommentCounter[text].push(now);
|
| 171 |
-
fastCommentCounter[text] = fastCommentCounter[text].filter(ts => now - ts < 60000);
|
| 172 |
-
|
| 173 |
-
if (fastCommentCounter[text].length >= 100 && !alertedComments.has(text)) {
|
| 174 |
-
alertedComments.add(text);
|
| 175 |
-
sendToTelegram(`โ ๏ธ <b>ุณุจุงู
ุณุฑูุน @${user}!</b>\n๐ฌ "<code>${text}</code>"\n๐ฅ ุชูุฑุฑ 100 ู
ุฑุฉ ูู ุฏูููุฉ!`);
|
| 176 |
-
setTimeout(() => alertedComments.delete(text), 300000);
|
| 177 |
-
}
|
| 178 |
}
|
| 179 |
-
});
|
| 180 |
-
|
| 181 |
-
// --- ู
ุดุงูุฏูู ---
|
| 182 |
-
connection.on('roomUser', d => {
|
| 183 |
-
const viewers = d.viewerCount;
|
| 184 |
-
if (viewers > maxViewers) maxViewers = viewers;
|
| 185 |
-
|
| 186 |
-
let currentHundred = Math.floor(viewers / 100) * 100;
|
| 187 |
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
// ุฏุฎูู ู
ุดุฑู
|
| 201 |
-
if (data.isModerator && !adminsSeen.has(data.uniqueId)) {
|
| 202 |
-
adminsSeen.add(data.uniqueId);
|
| 203 |
-
sendToTelegram(`๐ก๏ธ <b>ู
ุดุฑู ุฏุฎู ุจุซ @${user}:</b>\n๐ค <code>@${data.uniqueId}</code>`);
|
| 204 |
-
}
|
| 205 |
-
|
| 206 |
-
// ุฏุฎูู VIP
|
| 207 |
-
if (level >= 30) {
|
| 208 |
-
sendToTelegram(`๐ <b>ุฏุฎูู VIP (Lvl ${level})</b>\n๐ค ุจุซ @${user}: <code>@${data.uniqueId}</code>`);
|
| 209 |
-
}
|
| 210 |
-
|
| 211 |
-
// โ Top Viewer Badge โ
|
| 212 |
-
if (data.userBadges && data.userBadges.length > 0) {
|
| 213 |
-
let hasTopViewer = data.userBadges.some(b => b.type === "top_viewer");
|
| 214 |
-
if (hasTopViewer) {
|
| 215 |
-
sendToTelegram(
|
| 216 |
-
`๐ <b>Top Viewer ุฏุฎู ุงูุจุซ!</b>\n` +
|
| 217 |
-
`๐ค ุงูู
ุณุชุฎุฏู
: <code>@${data.uniqueId}</code>\n` +
|
| 218 |
-
`๐บ ูู ุจุซ: @${user}`
|
| 219 |
-
);
|
| 220 |
-
}
|
| 221 |
-
}
|
| 222 |
-
});
|
| 223 |
-
|
| 224 |
-
// --- ูุฏุงูุง ---
|
| 225 |
-
connection.on('gift', (data) => {
|
| 226 |
-
|
| 227 |
-
if (data.giftType === 1 && !data.repeatEnd) return;
|
| 228 |
-
|
| 229 |
-
let giftCost = data.diamondCount * data.repeatCount;
|
| 230 |
-
|
| 231 |
-
if (!giftersMap[data.userId])
|
| 232 |
-
giftersMap[data.userId] = { name: data.nickname, coins: 0 };
|
| 233 |
-
giftersMap[data.userId].coins += giftCost;
|
| 234 |
-
|
| 235 |
-
if (giftCost > bestGift.cost)
|
| 236 |
-
bestGift = { name: data.giftName, cost: giftCost, sender: data.nickname, icon: data.giftPictureUrl };
|
| 237 |
-
|
| 238 |
-
// --- ู
ูุฒุฉ 7: ุฅุฑุณุงู ุตูุฑุฉ ุงููุฏูุฉ ---
|
| 239 |
-
if (data.giftPictureUrl) {
|
| 240 |
-
sendToTelegram(
|
| 241 |
-
`๐ <b>ูุฏูุฉ ุฌุฏูุฏุฉ!</b>\n` +
|
| 242 |
-
`๐ค ู
ู: <b>${data.nickname}</b>\n` +
|
| 243 |
-
`๐ ุงููุฏูุฉ: <b>${data.giftName}</b>\n` +
|
| 244 |
-
`๐ ุงูููู
ุฉ: <b>${giftCost}</b>`,
|
| 245 |
-
data.giftPictureUrl
|
| 246 |
-
);
|
| 247 |
-
}
|
| 248 |
-
|
| 249 |
-
// --- ู
ูุฒุฉ 9: ูุฏูุฉ ููุงุด ---
|
| 250 |
-
if (data.repeatCount > 1 && data.repeatEnd === true) {
|
| 251 |
-
sendToTelegram(
|
| 252 |
-
`โก <b>ูุฏูุฉ ููุงุด ู
ูุชู
ูุฉ!</b>\n` +
|
| 253 |
-
`๐ ${data.giftName}\n` +
|
| 254 |
-
`๐ฅ ุงูุนุฏุฏ: ${data.repeatCount}\n` +
|
| 255 |
-
`๐ค ู
ู: <b>${data.nickname}</b>`
|
| 256 |
-
);
|
| 257 |
-
}
|
| 258 |
-
|
| 259 |
-
});
|
| 260 |
-
|
| 261 |
-
// --- ุชุซุจูุช ุชุนููู ---
|
| 262 |
-
connection.on('livePinnedMessage', (data) => {
|
| 263 |
-
let sender = data.user?.uniqueId || "ุงูู
ุถูู";
|
| 264 |
-
let text = data.content || data.text || "ุชุนููู ุบูุฑ ู
ุนุฑูู";
|
| 265 |
-
|
| 266 |
-
sendToTelegram(
|
| 267 |
-
`๐ <b>ุชู
ุชุซุจูุช ุชุนููู ูู ุจุซ @${user}</b>\n` +
|
| 268 |
-
`๐ค ุจูุงุณุทุฉ: <code>@${sender}</code>\n` +
|
| 269 |
-
`๐ฌ <b>${text}</b>`
|
| 270 |
-
);
|
| 271 |
-
});
|
| 272 |
-
|
| 273 |
-
connection.on('roomPinMessage', (data) => {
|
| 274 |
-
let sender = data.user?.uniqueId || "ุงูู
ุถูู";
|
| 275 |
-
let text = data.content || data.text || "ุชุนููู ุบูุฑ ู
ุนุฑูู";
|
| 276 |
-
|
| 277 |
-
sendToTelegram(
|
| 278 |
-
`๐ <b>ุชู
ุชุซุจูุช ุชุนููู ูู ุจุซ @${user}</b>\n` +
|
| 279 |
-
`๐ค ุจูุงุณุทุฉ: <code>@${sender}</code>\n` +
|
| 280 |
-
`๐ฌ <b>${text}</b>`
|
| 281 |
-
);
|
| 282 |
-
});
|
| 283 |
-
|
| 284 |
-
// --- ููุงูุฉ ุงูุจุซ ---
|
| 285 |
-
connection.on('disconnected', () => {
|
| 286 |
-
const diffMs = new Date() - startTime;
|
| 287 |
-
const totalMinutes = startTime ? Math.floor(diffMs / 60000) : 0;
|
| 288 |
-
const durationStr = formatDuration(totalMinutes);
|
| 289 |
-
|
| 290 |
-
let sortedGifters = Object.values(giftersMap).sort((a, b) => b.coins - a.coins).slice(0, 3);
|
| 291 |
-
let sortedCommenters = Object.values(commentersMap).sort((a, b) => b.count - a.count).slice(0, 5);
|
| 292 |
-
|
| 293 |
-
let endMsg =
|
| 294 |
-
`๐ <b>ู
ูุฎุต ุงูููุงูุฉ (@${user})</b>\n` +
|
| 295 |
-
`โโโโโโโโโโโโโโโโโ\n` +
|
| 296 |
-
`โฑ๏ธ <b>ุงูู
ุฏุฉ:</b> ${durationStr} | ๐
<b>ุงูููุช:</b> ${getBaghdadTime()}\n` +
|
| 297 |
-
`๐ ๐๏ธ ${formatK(maxViewers)} | โค๏ธ ${formatK(totalLikes)} | ๐ ${totalShares}\n` +
|
| 298 |
-
`โโโโโโโโโโโโโโโโโ\n` +
|
| 299 |
-
`๐ <b>ุฃูุถู 3 ุฏุงุนู
ูู:</b>\n`;
|
| 300 |
-
|
| 301 |
-
sortedGifters.forEach((g, i) => {
|
| 302 |
-
endMsg += `${i === 0 ? '๐ฅ' : i === 1 ? '๐ฅ' : '๐ฅ'} <code>${g.name}</code> : <b>${formatK(g.coins)}</b>\n`;
|
| 303 |
});
|
| 304 |
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
});
|
| 309 |
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
|
| 318 |
-
|
| 319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
}
|
| 321 |
|
| 322 |
-
|
| 323 |
-
if (ACCOUNTS_TO_WATCH.length > 0)
|
| 324 |
-
ACCOUNTS_TO_WATCH.forEach(user => startRadar(user));
|
| 325 |
-
|
| 326 |
-
// --- ุงูุณูุฑูุฑ ---
|
| 327 |
-
const server = http.createServer((req, res) => res.end('Radar Mega V7.1 Active ๐'));
|
| 328 |
-
server.listen(7860, '0.0.0.0', () => {
|
| 329 |
-
setInterval(() => {
|
| 330 |
-
http.get(`http://localhost:7860`, () => {}).on('error', () => {});
|
| 331 |
-
}, 240000);
|
| 332 |
-
});
|
|
|
|
| 1 |
const { WebcastPushConnection } = require('tiktok-live-connector');
|
| 2 |
const axios = require('axios');
|
|
|
|
|
|
|
| 3 |
|
| 4 |
// --- ุฅุนุฏุงุฏุงุช ุงููุธุงู
---
|
| 5 |
+
const TIKTOK_USERNAME = "USERNAME_HERE"; // ุถุน ุงุณู
ุตุงุญุจ ุงูุจุซ
|
| 6 |
+
const TELEGRAM_BOT_TOKEN = "YOUR_TELEGRAM_TOKEN";
|
| 7 |
+
const TELEGRAM_CHAT_ID = "YOUR_CHAT_ID";
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
// --- ุฏุงูุฉ ุฅุฑุณุงู ุฑุณุงุฆู ุชูุฌุฑุงู
ู
ุน ุชูุณูู ุงุญุชุฑุงูู ---
|
| 10 |
+
async function sendToTelegram(message, imageUrl = null) {
|
| 11 |
+
try {
|
| 12 |
+
if (imageUrl) {
|
| 13 |
+
await axios.post(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendPhoto`, {
|
| 14 |
+
chat_id: TELEGRAM_CHAT_ID,
|
| 15 |
+
photo: imageUrl,
|
| 16 |
+
caption: message,
|
| 17 |
+
parse_mode: "HTML"
|
| 18 |
+
});
|
| 19 |
+
} else {
|
| 20 |
+
await axios.post(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`, {
|
| 21 |
+
chat_id: TELEGRAM_CHAT_ID,
|
| 22 |
+
text: message,
|
| 23 |
+
parse_mode: "HTML"
|
| 24 |
+
});
|
| 25 |
+
}
|
| 26 |
+
} catch (err) {
|
| 27 |
+
console.log("Telegram Error:", err.message);
|
| 28 |
+
}
|
| 29 |
}
|
| 30 |
|
| 31 |
+
// --- ุฏุงูุฉ ุชูุณูู ุงูููุช ุจุดูู ุงุญุชุฑุงูู ---
|
| 32 |
function getBaghdadTime() {
|
| 33 |
+
return new Intl.DateTimeFormat('ar-IQ', { timeZone: 'Asia/Baghdad', dateStyle: 'medium', timeStyle: 'medium', hour12: true }).format(new Date());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
+
// --- ุจุฏุก ุงูุฑุงุฏุงุฑ ---
|
| 37 |
+
async function startRadar() {
|
| 38 |
+
const connection = new WebcastPushConnection(TIKTOK_USERNAME);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
// --- ุฌูุจ ุงูุฏููุฉ ูุจู ุงูุจุซ ---
|
| 41 |
try {
|
| 42 |
+
const info = await connection.getRoomInfo();
|
| 43 |
+
const country = info?.owner?.region || info?.owner?.country || "ุบูุฑ ู
ุนุฑูู";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
const startMsg =
|
| 46 |
+
`๐ข <b>ุชู
ุจุฏุก ุงูุฑุงุฏุงุฑ ููุจุซ</b>\n` +
|
| 47 |
+
`โโโโโโโโโโโโโโโโโโโโโโโโโ\n` +
|
| 48 |
+
`๐ค ุงูุญุณุงุจ: @${TIKTOK_USERNAME}\n` +
|
| 49 |
+
`๐ ุงูุฏููุฉ: <b>${country}</b>\n` +
|
| 50 |
+
`โฐ ุงูููุช: ${getBaghdadTime()}\n` +
|
| 51 |
+
`โโโโโโโโโโโโโโโโโโโโโโโโโ`;
|
| 52 |
|
| 53 |
+
await sendToTelegram(startMsg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
} catch (e) {
|
| 56 |
+
console.log("ูุง ูู
ูู ุฌูุจ ุงูุฏููุฉ ุงูุขู");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
// --- ุนูุฏ ุงูุงุชุตุงู ุจุงูุจุซ ---
|
| 60 |
+
connection.connect().then(state => {
|
| 61 |
+
const liveMsg =
|
| 62 |
+
`๐ด <b>ุงูุจุซ ุงูู
ุจุงุดุฑ ุจุฏุฃ ุงูุขู!</b>\n` +
|
| 63 |
+
`โโโโโโโโโโโโโโโโโโโโโโโโโ\n` +
|
| 64 |
+
`๐ค ุงูุญุณุงุจ: @${TIKTOK_USERNAME}\n` +
|
| 65 |
+
`๐ ุงูุฏููุฉ: <b>${state.roomInfo.owner?.region || state.roomInfo.owner?.country || "ุบูุฑ ู
ุนุฑูู"}</b>\n` +
|
| 66 |
+
`โฐ ุงูููุช: ${getBaghdadTime()}\n` +
|
| 67 |
+
`๐ <a href="https://www.tiktok.com/@${TIKTOK_USERNAME}/live">ุฑุงุจุท ุงูุจุซ ุงูู
ุจุงุดุฑ</a>\n` +
|
| 68 |
+
`โโโโโโโโโโโโโโโโโโโโโโโโโ`;
|
| 69 |
+
|
| 70 |
+
sendToTelegram(liveMsg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
});
|
| 72 |
|
| 73 |
+
// --- ุฏุฎูู ู
ุดุงูุฏ / VIP / Top Viewer ---
|
| 74 |
+
connection.on('member', data => {
|
| 75 |
+
const level = data.userLevel || (data.user && data.user.userLevel) || 0;
|
| 76 |
+
|
| 77 |
+
let memberMsg = '';
|
| 78 |
+
if (data.isModerator) {
|
| 79 |
+
memberMsg += `๐ก๏ธ <b>ู
ุดุฑู ุฏุฎู ุงูุจุซ</b>\n`;
|
| 80 |
+
}
|
| 81 |
+
if (level >= 30) {
|
| 82 |
+
memberMsg += `๐ <b>VIP (Lvl ${level}) ุฏุฎู ุงูุจุซ</b>\n`;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
if (data.userBadges && data.userBadges.length > 0) {
|
| 86 |
+
const hasTopViewer = data.userBadges.some(b => b.type === "top_viewer");
|
| 87 |
+
if (hasTopViewer) {
|
| 88 |
+
memberMsg += `๐
<b>Top Viewer ุฏุฎู ุงูุจุซ!</b>\n`;
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
if (memberMsg) {
|
| 93 |
+
memberMsg += `๐ค ุงูู
ุณุชุฎุฏู
: <code>@${data.uniqueId}</code>\n` +
|
| 94 |
+
`โฐ ุงูููุช: ${getBaghdadTime()}\n` +
|
| 95 |
+
`โโโ๏ฟฝ๏ฟฝ๏ฟฝโโโโโโโโโโโโโโโโโโโโโ`;
|
| 96 |
+
sendToTelegram(memberMsg);
|
| 97 |
+
}
|
| 98 |
});
|
| 99 |
|
| 100 |
+
// --- ุงููุฏุงูุง ---
|
| 101 |
+
connection.on('gift', data => {
|
| 102 |
+
let giftCost = data.diamondCount * data.repeatCount;
|
| 103 |
+
|
| 104 |
+
// ุฑุณุงูุฉ ุงุญุชุฑุงููุฉ ูููุฏูุฉ
|
| 105 |
+
const giftMsg =
|
| 106 |
+
`๐ <b>ูุฏูุฉ ุฌุฏูุฏุฉ!</b>\n` +
|
| 107 |
+
`โโโโโโโโโโโโโโโโโโโโโโโโโ\n` +
|
| 108 |
+
`๐ค ู
ู: <b>${data.nickname}</b>\n` +
|
| 109 |
+
`๐ ุงุณู
ุงููุฏูุฉ: <b>${data.giftName}</b>\n` +
|
| 110 |
+
`๐ ุงูููู
ุฉ: <b>${giftCost}</b>\n` +
|
| 111 |
+
`โฐ ุงูููุช: ${getBaghdadTime()}\n` +
|
| 112 |
+
`โโโโโโโโโโโโโโโโโโโโโโโโโ`;
|
| 113 |
+
|
| 114 |
+
if (data.giftPictureUrl) {
|
| 115 |
+
sendToTelegram(giftMsg, data.giftPictureUrl);
|
| 116 |
+
} else {
|
| 117 |
+
sendToTelegram(giftMsg);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
// ูุฏูุฉ ููุงุด
|
| 121 |
+
if (data.repeatCount > 1 && data.repeatEnd === true) {
|
| 122 |
+
const streakMsg =
|
| 123 |
+
`โก <b>ูุฏูุฉ ููุงุด ู
ูุชู
ูุฉ!</b>\n` +
|
| 124 |
+
`๐ค ู
ู: <b>${data.nickname}</b>\n` +
|
| 125 |
+
`๐ ${data.giftName}\n` +
|
| 126 |
+
`๐ฅ ุงูุนุฏุฏ: ${data.repeatCount}\n` +
|
| 127 |
+
`โฐ ุงูููุช: ${getBaghdadTime()}\n` +
|
| 128 |
+
`โโโโโโโโโโโโโโโโโโโโโโโโโ`;
|
| 129 |
+
sendToTelegram(streakMsg);
|
| 130 |
+
}
|
| 131 |
+
});
|
| 132 |
|
| 133 |
+
// --- ุชุซุจูุช ุชุนููู ---
|
| 134 |
+
const pinnedHandler = (data) => {
|
| 135 |
+
const sender = data.user?.uniqueId || "ุงูู
ุถูู";
|
| 136 |
+
const text = data.content || data.text || "ุชุนููู ุบูุฑ ู
ุนุฑูู";
|
| 137 |
+
|
| 138 |
+
const pinnedMsg =
|
| 139 |
+
`๐ <b>ุชุนููู ู
ุซุจุช</b>\n` +
|
| 140 |
+
`๐ค ุจูุงุณุทุฉ: <code>@${sender}</code>\n` +
|
| 141 |
+
`๐ฌ ${text}\n` +
|
| 142 |
+
`โฐ ุงูููุช: ${getBaghdadTime()}\n` +
|
| 143 |
+
`โโโโโโโโโโโโโโโโโโโโโโโโโ`;
|
| 144 |
+
|
| 145 |
+
sendToTelegram(pinnedMsg);
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
connection.on('livePinnedMessage', pinnedHandler);
|
| 149 |
+
connection.on('roomPinMessage', pinnedHandler);
|
| 150 |
+
|
| 151 |
+
// --- ุงูุชูุงุก ุงูุจุซ ---
|
| 152 |
+
connection.on('streamEnd', () => {
|
| 153 |
+
const endMsg =
|
| 154 |
+
`๐ด <b>ุงูุชูู ุงูุจุซ</b>\n` +
|
| 155 |
+
`๐ค @${TIKTOK_USERNAME}\n` +
|
| 156 |
+
`โฐ ุงูููุช: ${getBaghdadTime()}\n` +
|
| 157 |
+
`โโโโโโโโโโโโโโโโโโโโโโโโโ`;
|
| 158 |
+
sendToTelegram(endMsg);
|
| 159 |
+
});
|
| 160 |
}
|
| 161 |
|
| 162 |
+
startRadar();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|