I found an answer on how to track invites here: How to make a invites command (Discord.js)
client.on('message', message => {
if(message.content === "-invite"){
message.guild.fetchInvites().then(invites =>
{
const userInvites = invites.array().filter(o => o.inviter.id === user.id);
var userInviteCount = 0;
for(var i=0; i < userInvites.length; i++)
{
var invite = userInvites[i];
userInviteCount += invite['uses'];
}
message.reply(`You have ${userInviteCount} invites.`);
}
)
}
});
But what worries me is that this solution could be used for a discord server with 50k members and could check invites every 1-5 seconds. Will the bot still work or will the list be too large or the requests too many? If the list is too large, is there any better method?