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/*
logs logs/ERROR.txt
logs/TEXT.txt
*.log *.log
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
+10 -9
View File
@@ -38,15 +38,16 @@ module.exports = {
message.guild.id, message.guild.id,
message.member, message.member,
); );
if (
(permissionLevel <= command.permission) &&
(client.config.owners.includes(!message.author.id) /*|| if (!client.config.owners.includes(message.author.id)) {
(!message.guild.ownerId == message.author.id)*/ if (message.guild.ownerId !== message.author.id) {
) if (permissionLevel < command.permission) {
) { return message.reply(
return message.reply( "Vous n'avez pas la permission d'utiliser cette commande.",
"Vous n'avez pas la permission d'utiliser cette commande.", );
); }
}
} }
try { try {
+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; return highestPermission;
}; };