mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-22 15:53:08 +02:00
fix: guild selector not filtering guilds (closes #408)
This commit is contained in:
parent
fa921fa5a6
commit
739efdcc3a
@ -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));
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user