当我尝试在“guildmemberadd”上编写代码时,我尝试在“成员加入和离开”上使用“邀请跟踪程序”,它工作正常,但当我尝试在“guildmemberremove”上编写代码时,它会出现以下错误: TypeError: Cannot read property 'inviter' of undefined
代码如下:
client.on('guildMemberRemove', async (member) => {
if(member.guild.id === '716675370501406831'){
const cachedInvites = guildInvites.get(member.guild.id);
const newInvites = await member.guild.fetchInvites();
guildInvites.set(member.guild.id, newInvites);
try{
const usedInvite = newInvites.find(inv => cachedInvites.get(inv.code).uses < inv.uses);
const invChannel = member.guild.channels.cache.get('863845982889312288');
invChannel.send(`${member} adlı kişi sunucudan ayrıldı onu ${usedInvite.inviter} tarafından davet edilmişti ve bu yüzden artık ${qdb.get(`${usedInvite.inviter.id}.inv`)} daveti kaldı`);
}
catch(err) {
console.log(err);
}
}
});
(在 invChannel.send()
有些地方不是英语,但不影响代码)
暂无答案!
目前还没有任何答案,快来回答吧!