Created
April 2, 2025 21:08
-
-
Save CommandLeo/1e865f91923c557f2acbb25ac258ce07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const invites = [ | |
'https://discord.gg/tvpccRczWx', // TMC Catalogue | |
'https://discord.gg/scicraft', // SciCraft | |
'https://discord.gg/JufJ6uf', // Storage Tech | |
'https://discord.gg/G9aa2YTTQX', // IanXO4's Server | |
'https://discord.gg/NWSYrZR', // Tech MC Archive | |
'https://discord.gg/njpAkGb5tc', // Slimestone Tech Archive | |
'https://discord.gg/7n2gEXJeAT', // The Archivists | |
'https://discord.gg/gZSVhBeCrW', // WaveTech | |
'https://discord.gg/khVURKrRcZ', // TaichiSMP | |
'https://discord.gg/CM52CAH', // Technical Minecraft Community | |
'https://discord.gg/EKKkyfcPPV', // Huge Fungi Huggers | |
'https://discord.gg/2QAdAEKPXA', // Chronos | |
'https://discord.gg/8bUbuuS', // Tree Huggers | |
'https://discord.gg/FDezNwZ3Rd', // Mob Farm Archive | |
'https://discord.gg/vPyUBcdmZV', // TNT Archive | |
'http://discord.gg/G52vRRb', // TIS Trinity Union | |
'https://discord.gg/c2DUWG8', // Mechanists | |
'https://discord.gg/bmZEHekk4w', // ProtoTech | |
'https://discord.gg/GJckUsHsVB', // NubTech | |
'https://discord.gg/BDRERKzwg9', // VoidCraft SMP | |
'https://discord.gg/8nGNTewveC', // Cartchives | |
'https://discord.gg/xa7QWAeAng', // Saints of Suppression | |
'https://discord.gg/guZdbQ9KQe', // Autocrafting Archive | |
'https://discord.gg/aSMscBFYRt', // Cloud Town Exquisite Craft | |
'https://discord.gg/QEAgkPXgqy', // Iron Lovers | |
'https://discord.gg/6F9sS2S', // r/redstone | |
'https://discord.gg/Ea28MyKB3J', // Wither Archive | |
'https://discord.gg/7P3nqzZ', // Monkeys | |
'https://discord.gg/tjayanzYMf', // CraftersHub | |
'https://discord.gg/AErTdWRgQa', // NuggTech | |
'https://discord.gg/5NWE5jRD3u', // AutoCraft | |
'https://discord.gg/jSe4jR5Kx7', // Computational Minecraft Archive | |
'https://discord.gg/BKadJsM', // Hypnos | |
'https://discord.gg/eBJbuNcGkH', // 404 Not Found | |
'https://discord.gg/EqNDFWjsUh', // Threadstone Archive | |
'https://discord.gg/ah7Ftxd', // Dugged | |
'https://discord.gg/sfCkZDA', // Hekate | |
'https://discord.gg/ZYYhAWQEa6', // HammerSMP | |
'https://discord.gg/keyy8As', // MineWave | |
'https://discord.gg/cQdfTXxdUz', // Seclosia | |
'https://discord.gg/99VW52r', // MelonTech | |
'https://discord.gg/Fnu5ttcdEZ' // KiwiTech | |
]; | |
const wait = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
let data = []; | |
for (let i = 0; i < invites.length; ) { | |
const inviteCode = invites[i].split('/').pop(); | |
const response = await fetch(`https://discord.com/api/v10/invites/${inviteCode}?with_counts=true`); | |
const json = await response.json(); | |
if (response.status == 429) { | |
await wait(json.retry_after * 1000 + 100); | |
} else { | |
data.push({ name: json.guild?.name, memberCount: json.approximate_member_count }); | |
i++; | |
} | |
} | |
const maxPositionLength = data.length.toString().length; | |
const maxNameLength = Math.max(...data.map(({ name }) => name.length)); | |
const maxCountLength = Math.max(...data.map(({ memberCount }) => memberCount.toString().length)); | |
const leaderboard = data | |
.sort((a, b) => b.memberCount - a.memberCount) | |
.map(({ name, memberCount }, i) => `${(i + 1).toString().padStart(maxPositionLength)}) ${name.padEnd(maxNameLength)} | ${memberCount.toString().padStart(maxCountLength)}`) | |
.join('\n'); | |
console.log(leaderboard); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment