Add whitelist for users as well
All checks were successful
CI / CI (push) Successful in 1m24s

This commit is contained in:
SileNce5k 2025-05-03 07:23:22 +02:00
parent 30c7fd171f
commit b8876188b1
Signed by: SileNce
GPG key ID: B0A142BB4291B204
4 changed files with 167 additions and 64 deletions

View file

@ -21,10 +21,13 @@ module.exports = function(client, owners, message, globalPrefix){
const command = client.commands.get(commandName);
if(!command) return;
if(command.needsWhitelist){
let isWhitelisted = client.whitelist.get(message.guild.id)?.includes(command.name);
if(!isWhitelisted){
message.channel.send(`\`${command.name}\` is not whitelisted in this server. The bot admin needs to whitelist the command in this server for it to work`)
return;
let isGuildWhitelisted = client.whitelist.get(message.guild.id)?.includes(command.name);
if(!isGuildWhitelisted){
let isUserWhitelisted = client.whitelist.user.get(message.author.id)?.includes(command.name);
if(!isUserWhitelisted){
message.channel.send(`\`${command.name}\` is not whitelisted in this server. The bot admin needs to whitelist the command in this server for it to work`)
return;
}
}
}
if (command.admin && owners.indexOf(message.author.id.toString()) == -1) return;