change out admin-only for minimum power level

This commit is contained in:
Ashley 2024-08-25 13:15:45 +00:00
parent da06f52739
commit 99e0b86d50
2 changed files with 4 additions and 3 deletions

View file

@ -46,7 +46,7 @@ export default {
command: "toggle",
name: "toggle",
usage: "<module>",
admin: true,
minPwr: 50,
desc: "toggle a module on or off in current channel",
execute
}

View file

@ -70,8 +70,9 @@ function doCommand(client, event, cmd, args) {
if(!command)
return false;
if((command.owner && event.sender.userId != process.env.OWNER_ID) || (command.admin && event.sender.powerLevel < 100 && event.sender.userId != process.env.OWNER_ID)) {
var addl = `Are you sure this command is for you?\nYour power level is ${event.sender.powerLevel}`;
if((command.owner && event.sender.userId != process.env.OWNER_ID) || (command.minPwr && event.sender.powerLevel < command.minPwr && event.sender.userId != process.env.OWNER_ID)) {
var addl = command.minPwr ? `this command requires a power level of ${command.minPwr}\nyour power level is ${event.sender.powerLevel}` : "this command is owner-only.";
client.reply(event, addl, '<img src="mxc://possum.city/b4Vo1BTcq49B7TbFWCqq76HQWQEdNIqq" alt="nuh uh" /><br>' + addl);
return true;
}