File size: 4,137 Bytes
6e93a96 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | import express from "express";
import fetch from "node-fetch";
const app = express();
const PORT = process.env.PORT || 5000;
// The Auth Token is now embedded directly into the URL query parameters
const AUTH_TOKEN = "AIzaSyBokCjJ7bIUOk_beo2gWQXst6PKqlFFEpc";
const API_URL = `https://yalohsosipisky-default-rtdb.firebaseio.com/servers.json?auth=${AUTH_TOKEN}`;
const DISCORD_WEBHOOK_URL = process.env.DISCORD_WEBHOOK_URL;
const REFRESH_RATE = 2000;
const PLACE_ID = "109983668079237";
let jobData = [];
let sentJobIds = new Set();
let isSending = false;
app.get("/", (req, res) => {
const html = `
<!DOCTYPE html>
<html>
<head>
<title>Job IDs</title>
<meta http-equiv="refresh" content="2">
<style>
body { font-family: monospace; background: #1a1a1a; color: #0f0; padding: 20px; }
h1 { color: #0f0; }
.job-id { padding: 5px 0; font-size: 16px; border-bottom: 1px solid #333; }
a { color: #0f0; text-decoration: none; font-weight: bold; }
a:hover { color: #fff; }
</style>
</head>
<body>
<h1>Job IDs (Authenticated)</h1>
${jobData.length > 0
? jobData.map(job => `<div class="job-id">${job.name} - ${job.money}/s - <a href="${job.link}" target="_blank">JOIN LINK</a></div>`).join('')
: '<p>Waiting for data from Firebase...</p>'}
</body>
</html>
`;
res.send(html);
});
app.get("/jobids", (req, res) => {
res.json(jobData);
});
async function sendToDiscord(newJobs) {
if (!DISCORD_WEBHOOK_URL || newJobs.length === 0 || isSending) return;
isSending = true;
for (const job of newJobs) {
if (sentJobIds.has(job.jobId)) continue;
sentJobIds.add(job.jobId);
try {
const message = {
embeds: [{
title: "π NEW SERVER FOUND",
color: 0x783cc4, // Purple color to match your UI
fields: [
{ name: "π Name", value: job.name, inline: true },
{ name: "𧬠Mutation", value: job.mutation, inline: true },
{ name: "π° Money/Sec", value: `${job.money}`, inline: true },
{ name: "πΎ Tier", value: job.tier, inline: true },
{ name: "π Job ID", value: `\`${job.jobId}\``, inline: false },
{ name: "π Join Link", value: `[Click to Join](https://www.roblox.com/games/${PLACE_ID}/?gameInstanceId=${job.jobId})`, inline: false }
],
timestamp: new Date()
}]
};
await fetch(DISCORD_WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(message)
});
console.log(`β
Notified Discord: ${job.name}`);
await new Promise(r => setTimeout(r, 1000)); // Prevent Discord rate limit
} catch (err) {
console.error("Discord Error:", err.message);
}
}
isSending = false;
}
async function fetchJobIds() {
try {
const response = await fetch(API_URL);
const data = await response.json();
if (data && typeof data === 'object') {
const formattedJobs = [];
// Firebase returns an object of objects, so we iterate through keys
for (const key in data) {
const server = data[key];
const jobId = server.jobId || key;
formattedJobs.push({
name: server.name || "Unknown",
mutation: server.isBrainrot ? "Brainrot" : "Normal",
money: server.moneyPerSec || "0",
tier: (server.name === "Strawberry Elephant" || server.name === "Meowl") ? "OG TIER" : "Secret",
jobId: jobId,
link: `https://www.roblox.com/games/${PLACE_ID}/?gameInstanceId=${jobId}`
});
}
jobData = formattedJobs;
const newJobs = jobData.filter(job => !sentJobIds.has(job.jobId));
if (newJobs.length > 0) {
sendToDiscord(newJobs);
}
}
} catch (err) {
console.error("Firebase Fetch Error:", err.message);
}
}
// Initial fetch and start interval
fetchJobIds();
setInterval(fetchJobIds, REFRESH_RATE);
app.listen(PORT, "0.0.0.0", () => {
console.log(`Server is live on port ${PORT}`);
}); |