Mise à jour des fonctions de permission et de l'emote pour la commande kick & add ban command

This commit is contained in:
Tutur33
2024-02-17 16:14:20 +01:00
parent 5a15326eba
commit 613a4bce87
3 changed files with 60 additions and 11 deletions
+14 -10
View File
@@ -12,18 +12,22 @@ async function getPermissionLevel(member, client) {
return 10;
}
let highestPermission = 0;
for (let i = 1; i <= 9; i++) {
const roleIds = await GestionDb.get(`${botId}.${member.guild.id}.p${i}`);
if (roleIds) {
// Si roleIds n'est pas un tableau, le convertir en tableau
if (!Array.isArray(roleIds)) {
roleIds = [roleIds];
}
if (roleIds.some(id => member.roles.cache.has(id))) {
highestPermission = Math.max(highestPermission, i);
try {
for (let i = 1; i <= 9; i++) {
const roleIds = await GestionDb.get(`${botId}.${member.guild.id}.p${i}`);
if (roleIds) {
// Si roleIds n'est pas un tableau, le convertir en tableau
if (!Array.isArray(roleIds)) {
roleIds = [roleIds];
}
if (roleIds.some(id => member.roles.cache.has(id))) {
highestPermission = Math.max(highestPermission, i);
}
}
}
return highestPermission;
} catch {
return highestPermission;
}
return highestPermission;
}
module.exports = { getPermissionLevel };