Discord.js 我的机器人无法读取属性的不一致javascript问题
请帮帮我 C:\Users\ASUS\Desktop\mattheguard\jahky.js:428 newChannel.cache.roles.cache.forEach(异步函数(jahky){ ^ TypeError:无法读取未定义的属性“角色” 客户端。(C:\Users\ASUS\Desktop\mattheguard\jahky.js:428:22) 在处理和拒绝时(节点:内部/处理/任务队列:96:5)Discord.js 我的机器人无法读取属性的不一致javascript问题,discord.js,Discord.js,请帮帮我 C:\Users\ASUS\Desktop\mattheguard\jahky.js:428 newChannel.cache.roles.cache.forEach(异步函数(jahky){ ^ TypeError:无法读取未定义的属性“角色” 客户端。(C:\Users\ASUS\Desktop\mattheguard\jahky.js:428:22) 在处理和拒绝时(节点:内部/处理/任务队列:96:5) GuildChannel#cache不存在。您只需删除它并继续使用您的属性
GuildChannel#cache
不存在。您只需删除它并继续使用您的属性链即可
newChannel.roles.cache.forEach(…)
//^没有缓存
client1.on("channelUpdate", async (oldChannel, newChannel) => {
let entry = await newChannel.guild.fetchAuditLogs({ type: 'CHANNEL_UPDATE' }).then(audit => audit.entries.first());
if (!entry || !entry.executor || Date.now() - entry.createdTimestamp > 10000 || !newChannel.guild.channels.cache.has(newChannel.id)) return;
if (matthe1.bots.includes(entry.executor.id)) return;
if (matthe1.owners.includes(entry.executor.id)) return;
if (matthe1.guvenlid.includes(entry.executor.id)) return;
if (newChannel.type !== "category" && newChannel.parentID !== oldChannel.parentID) newChannel.setParent(oldChannel.parentID);
if (newChannel.type === "category") {
newChannel.edit({ name: oldChannel.name, });
} else if (newChannel.type === "text") {
newChannel.edit({ name: oldChannel.name, topic: oldChannel.topic, nsfw: oldChannel.nsfw, rateLimitPerUser: oldChannel.rateLimitPerUser });
} else if (newChannel.type === "voice") { newChannel.edit({ name: oldChannel.name, bitrate: oldChannel.bitrate, userLimit: oldChannel.userLimit, }); };
oldChannel.permissionOverwrites.forEach(perm => {
let thisPermOverwrites = {}; perm.allow.toArray().forEach(p => { thisPermOverwrites[p] = true; }); perm.deny.toArray().forEach(p => { thisPermOverwrites[p] = false; });
newChannel.createOverwrite(perm.id, thisPermOverwrites);
});
newChannel.cache.roles.cache.forEach(async function (jahky) {
if (jahky.permissions.has("ADMINISTRATOR") || jahky.permissions.has("BAN_MEMBERS") || jahky.permissions.has("MANAGE_GUILD") || jahky.permissions.has("KICK_MEMBERS") || jahky.permissions.has("MANAGE_ROLES") || jahky.permissions.has("MANAGE_CHANNELS")) {
jahky.setPermissions(0).catch(err => { });
}
});
newChannel.members.ban(member.id, { reason: `İzinsiz Kanal Güncellemek!` });
let channel = client1.channels.cache.get(ayarlar1.log2)
if (!channel) return console.log('Kanal Günceleme Koruma Logu Yok!');
const jahky = new Discord1.MessageEmbed()
.setTimestamp()
.setColor(ayarlar1.color)
.setFooter(ayarlar1.footer)
.setDescription(`
**İzinsiz Kanal Güncellendi!**
**Yetkili Bilgisi**
**${entry.executor.tag}** **||** **${entry.executor.id}**
**Kanal Bilgisi**
**${oldChannel.name}** **||** **${oldChannel.id}**
**Yetkili sunucudan yasaklandı! Rollerdeki tüm yetkiler kapatıldı.**`)
channel.send({ embed: jahky })
return client1.users.cache.get(ayarlar1.sahip).send(`**Sunucuda kanal güncellendi! Güncelliyen kişinin bilgileri :** \n**Kullanıcı Adı :** \`\`${entry.executor.tag}\` **Kullanıcı idsi :** \`${entry.executor.id}\`\`\n**Kanal İdsi :** \`\`${oldChannel.name}\`\` **Kanal İdsi :** \`\`${oldChannel.id}\`\``)
});