Answer the question
In order to leave comments, you need to log in
How to display the number of invited users?
How to display to the user when requesting for example "!invites" , the number of participants invited by him
For example:
User: !invites
Bot: You invited (number) users to the server!
Answer the question
In order to leave comments, you need to log in
use the .fetchInvites() method :
var user = null;
user = message.mentions.members.first() || 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.channel.send(`Вы пригласили ${userInviteCount} пользователей на сервер!`);
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question