I am trying to make a discord bot that will help me with my server invite management like InviteManager bot which really sucks. I wanna make my own bot to do that. So further I made code to get invites of Command Author but I don't know how to make it fetch and display mentioned user invites also.
Thanks in advance
client.on('message', message => {
if(message.content === "-invites"){
var user = null;
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 invited ${userInviteCount} user(s) to this server. Keep up the good work!`);
}
)
}
});