'I need help for discord js v13
my code
function kanalbackup() {
let guild = client.guilds.cache.get(ayarlar.guildID);
if (!guild) return;
if (guild) {
guild.channels.cache.filter(kanal => kanal.deleted !== true).forEach(channel => {
let permissionss = {};
let sayi = Number(0);
channel.PermissionOverwriteManager.forEach((perm) => {
let thisPermOverwrites = {};
perm.allow.toArray().forEach(p => {
thisPermOverwrites[p] = true;
});
perm.deny.toArray().forEach(p => {
thisPermOverwrites[p] = false;
});
permissionss[sayi] = {permission: perm.id == null ? guild.id : perm.id, thisPermOverwrites};
sayi++;
})
error
Channel#deleted is deprecated,
(Use node --trace-deprecation ... to show where the warning was created)
TypeError: channel.permissionOverwrites.forEach is not a function
Discord js upgrade error v12 to v13 ı need help
Solution 1:[1]
Basically the function channel.deleted has been removed from discord.js and you can't use it anymore. Full article on this: https://github.com/discordjs/discord.js/issues/7091. You can simply remove the filter in the channel cache to solve the problem. It also appears that you haven't created a permissionOveriteManager, and it's spelled wrong. The code would then look like the following:
function kanalbackup() {
let guild = client.guilds.cache.get(ayarlar.guildID);
if (!guild) return;
if (guild) {
guild.channels.cache.forEach(channel => {
let permissionss = {};
let sayi = Number(0);
channel.permissionOverwriteManager.create().forEach((perm) => {
let thisPermOverwrites = {};
perm.allow.toArray().forEach(p => {
thisPermOverwrites[p] = true;
});
perm.deny.toArray().forEach(p => {
thisPermOverwrites[p] = false;
});
permissionss[sayi] = {permission: perm.id == null ? guild.id : perm.id, thisPermOverwrites};
sayi++;
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
