AlmondPark33609
@AlmondPark33609
Занимаюсь кодингом как хобби

Как узнать кто пригласил пользователя на сервер discord.js?

Попробовал код:
client.on('guildMemberAdd', member => {
member.guild.fetchInvites().then(guildInvites => {
    // This is the *existing* invites for the guild.
    const ei = invites[member.guild.id];
    // Update the cached invites for the guild.
    invites[member.guild.id] = guildInvites;
    // Look through the invites, find the one for which the uses went up.
    const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
    // This is just to simplify the message being sent below (inviter doesn't have a tag property)
    const inviter = client.users.cache.find(invite.inviter.id);
    console.log(inviter.tag)
    })
})

Выдаёт ошибку Cannot read property 'get' of undefined
Может быть я туплю...
  • Вопрос задан
  • 843 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы