Recently, I developed a NextJs dashboard that enables Discord users to connect to their accounts. One of the main features is retrieving the user's guilds and filtering them to include only the ones where the user has either the MANAGE_GUILD permission or ownership.
I attempted to create a function to sort the guilds based on these criteria but it doesn't seem to be functioning correctly.
export function guildsperm(guilds) {
guilds.map((guilds) => {
if (guilds.owner === true) {
return guilds;
} else if (guilds.permissions <= 0x0000000020) {
return guilds;
} else {
return;
}
});
}
You can refer to the documentation for more information: