Channel's Permissions Update

Hi, how can i check if channel's permissions has been changed ?
Here is my code :
if(oldChannel.permissionOverwrites.length == newChannel.permissionOverwrites.length)
            {
                if(oldChannel.name != newChannel.name) 
                    embed.data.description += `**Nom :** \`${oldChannel.name}\` ➜ \`${newChannel.name}\``;
                if (oldChannel.topic !== newChannel.topic) {
                    const oldTopic = oldChannel.topic || '';
                    const newTopic = newChannel.topic || '';
                    let formattedTopic = '**Sujet du salon :** ';

                    const differentWords = Diff.diffWords(oldTopic, newTopic);
                    differentWords.forEach(part => {
                        if (part.added)
                            formattedTopic += `**${part.value}** `;
                        else if (part.removed)
                        {
                            if (part.value.trim() === '')
                                formattedTopic += ' ';
                            else 
                            {
                                const spaceBefore = part.value.startsWith(' ') ? ' ' : '';
                                const spaceAfter = part.value.endsWith(' ') ? ' ' : '';
                                const valueWithoutSpaces = part.value.trim();
                                formattedTopic += `${spaceBefore}~~${valueWithoutSpaces}~~${spaceAfter}`;
                            }
                        }
                        else
                            formattedTopic += part.value;
                    });
                
                    embed.data.description += `${formattedTopic}\n`;
                }                
                if(oldChannel.type != newChannel.type) 
                    embed.data.description += `**Salon d'annonces :** \`${newChannel.type == 5 ? "Activé" : "Désactivé"}\`\n`;
                if(oldChannel.nsfw != newChannel.nsfw) 
                    embed.data.description += `**NSFW :** \`${newChannel.nsfw == true ? "Activé" : "Désactivé"}\`\n`;
                if(oldChannel.rateLimitPerUser != newChannel.rateLimitPerUser) 
                    embed.data.description += `**Mode lent :** \`${newChannel.rateLimitPerUser == 0 ? "Désactivé" : newChannel.rateLimitPerUser}\` ➜ \`${newChannel.rateLimitPerUser == 0 ? "Désactivé" : newChannel.rateLimitPerUser}\`\n`;
            }
            else
            {
                embed.setTitle("Modification des permissions d'un salon");

                const oldPermissions = oldChannel.permissionOverwrites;
                const newPermissions = newChannel.permissionOverwrites;

                console.log(oldPermissions);
                console.log(newPermissions);
            }
Was this page helpful?