I am trying to get the invites of the author of the command to the one server [Not multiple servers just one] I have tried many solutions but many seem outdated or wrong. Here is what I came up with
exports.run = async (client, message, args) => {
var user = message.author;
message.guild.invites.fetch()
.then(invites => {
const userInvites = invites.filter(o => o.inviter.id === user.id);
var userInviteCount = 0;
console.log(userInvites['uses']);
for (var i=0; i < userInvites.length; i++) {
var invite = userInvites[i];
userInviteCount += invite['uses'];
}
message.reply(`You have ${userInviteCount} invites.`);
} )
}
This is in an invite.js file so when a user runs !invites it runs this command after exports.run