Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -268,8 +268,8 @@ client.on('messageCreate', async (message) => {
|
|
| 268 |
|
| 269 |
const statusMsg = await message.reply("🔍 Scanning all servers and generating invite links... This may take a moment.");
|
| 270 |
|
| 271 |
-
const
|
| 272 |
-
let invite =
|
| 273 |
try {
|
| 274 |
let channel = g.systemChannel || g.channels.cache.find(c => c.isTextBased() && c.permissionsFor(g.members.me).has('CreateInstantInvite'));
|
| 275 |
if (channel) {
|
|
@@ -277,27 +277,25 @@ client.on('messageCreate', async (message) => {
|
|
| 277 |
invite = inv.url;
|
| 278 |
}
|
| 279 |
} catch (e) {}
|
| 280 |
-
return
|
| 281 |
}));
|
| 282 |
|
| 283 |
-
|
| 284 |
-
let chunk = `🤖 **Full Server Registry Report** (${client.guilds.cache.size} total)\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n`;
|
| 285 |
-
for (const line of guildsInfo) {
|
| 286 |
-
if (chunk.length + line.length > 1900) { chunks.push(chunk); chunk = ""; }
|
| 287 |
-
chunk += line + "\n";
|
| 288 |
-
}
|
| 289 |
-
if (chunk) chunks.push(chunk);
|
| 290 |
|
| 291 |
-
let
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
|
|
|
|
|
|
|
|
|
| 295 |
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
|
|
|
| 301 |
}
|
| 302 |
|
| 303 |
if (commandName === 'uptime') {
|
|
|
|
| 268 |
|
| 269 |
const statusMsg = await message.reply("🔍 Scanning all servers and generating invite links... This may take a moment.");
|
| 270 |
|
| 271 |
+
const guildsInfoRaw = await Promise.all(client.guilds.cache.map(async g => {
|
| 272 |
+
let invite = null;
|
| 273 |
try {
|
| 274 |
let channel = g.systemChannel || g.channels.cache.find(c => c.isTextBased() && c.permissionsFor(g.members.me).has('CreateInstantInvite'));
|
| 275 |
if (channel) {
|
|
|
|
| 277 |
invite = inv.url;
|
| 278 |
}
|
| 279 |
} catch (e) {}
|
| 280 |
+
return { name: g.name, count: g.memberCount, link: invite };
|
| 281 |
}));
|
| 282 |
|
| 283 |
+
guildsInfoRaw.sort((a, b) => b.count - a.count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
|
| 285 |
+
let desc = "";
|
| 286 |
+
guildsInfoRaw.forEach((g, i) => {
|
| 287 |
+
const serverName = g.link ? `[${g.name}](${g.link})` : g.name;
|
| 288 |
+
let line = `**${i + 1}.** ${serverName} — \`${g.count}\` members\n`;
|
| 289 |
+
if (desc.length + line.length < 4000) desc += line; // Embed safety cap
|
| 290 |
+
});
|
| 291 |
+
desc += `\nTotal servers: ${client.guilds.cache.size}`;
|
| 292 |
|
| 293 |
+
const embed = new EmbedBuilder()
|
| 294 |
+
.setTitle(`🌐 Serving ${client.guilds.cache.size} Servers`)
|
| 295 |
+
.setDescription(desc)
|
| 296 |
+
.setColor('#5865F2');
|
| 297 |
+
|
| 298 |
+
await statusMsg.edit({ content: null, embeds: [embed] });
|
| 299 |
}
|
| 300 |
|
| 301 |
if (commandName === 'uptime') {
|