Ask coding questions

← Back to all posts
How do you make a 3 way invite tracker
NoobieZr (8)

I made this simple invite tracker code (shown below). But I want to make it better with the following 3 things:

  • Make it so you can use it on other people, e.g zl invites @user
  • Make it so you can take away invites. e.g zl remove invites @user 3

If you know how to do any of these please tell me! :D
You can DM me on discord as I am more active over there: Tagged#4121

Code:
client.on('message', message => {
if(message.content === "zr invites"){
var user = message.author;

    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.`);
        }
    )
}

});