fix: guild selector not filtering guilds (closes #408)

This commit is contained in:
Isaac 2023-05-23 16:51:19 +01:00
parent fa921fa5a6
commit 739efdcc3a
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -2,14 +2,11 @@ const { PermissionsBitField } = require('discord.js');
/**
*
* @param {import("client")} client
* @param {import("discord.js").Client} client
* @param {string} userId
* @returns {Promise<Collection<import("discord.js").Guild>}
*/
module.exports.getCommonGuilds = async (client, userId) => await client.guilds.cache.filter(async guild => {
const member = await guild.members.fetch(userId);
return !!member;
});
module.exports.getCommonGuilds = (client, userId) => client.guilds.cache.filter(guild => guild.members.cache.has(userId));
/**
* @param {import("discord.js").Guild} guild
@ -48,4 +45,4 @@ module.exports.isStaff = async (guild, userId) => {
if (guildMember.permissions.has(PermissionsBitField.Flags.ManageGuild)) return true;
const staffRoles = await client.keyv.get(`cache/guild-staff:${guild.id}`) || await updateStaffRoles(guild);
return staffRoles.some(r => guildMember.roles.cache.has(r));
};
};