mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-12 23:59:20 +02:00
Mise à jour des fonctions de permission et de l'emote pour la commande kick & add ban command
This commit is contained in:
+14
-10
@@ -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 };
|
||||
Reference in New Issue
Block a user