corrige perm bug

This commit is contained in:
arthur
2024-07-08 22:39:14 +02:00
parent 287122e285
commit 4f1ab3e811
3 changed files with 18 additions and 11 deletions
+2 -1
View File
@@ -3,7 +3,8 @@ db.sqlite
# Logs
logs/*
logs
logs/ERROR.txt
logs/TEXT.txt
*.log
npm-debug.log*
yarn-debug.log*
+7 -6
View File
@@ -38,16 +38,17 @@ module.exports = {
message.guild.id,
message.member,
);
if (
(permissionLevel <= command.permission) &&
(client.config.owners.includes(!message.author.id) /*||
(!message.guild.ownerId == message.author.id)*/
)
) {
if (!client.config.owners.includes(message.author.id)) {
if (message.guild.ownerId !== message.author.id) {
if (permissionLevel < command.permission) {
return message.reply(
"Vous n'avez pas la permission d'utiliser cette commande.",
);
}
}
}
try {
command.execute(message, args, client);
+6 -1
View File
@@ -14,6 +14,11 @@ module.exports = async function getPermissionLevel(serverId, user) {
);
});
const highestPermission = Math.max(...perms.map((perm) => perm.permission));
let highestPermission;
if (perms.length === 0) {
highestPermission = 0
} else {
highestPermission = Math.max(...perms.map((perm) => perm.permission));
}
return highestPermission;
};