change out admin-only for minimum power level
This commit is contained in:
parent
da06f52739
commit
99e0b86d50
2 changed files with 4 additions and 3 deletions
|
@ -46,7 +46,7 @@ export default {
|
||||||
command: "toggle",
|
command: "toggle",
|
||||||
name: "toggle",
|
name: "toggle",
|
||||||
usage: "<module>",
|
usage: "<module>",
|
||||||
admin: true,
|
minPwr: 50,
|
||||||
desc: "toggle a module on or off in current channel",
|
desc: "toggle a module on or off in current channel",
|
||||||
execute
|
execute
|
||||||
}
|
}
|
||||||
|
|
5
index.js
5
index.js
|
@ -70,8 +70,9 @@ function doCommand(client, event, cmd, args) {
|
||||||
if(!command)
|
if(!command)
|
||||||
return false;
|
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)) {
|
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 = `Are you sure this command is for you?\nYour power level is ${event.sender.powerLevel}`;
|
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);
|
client.reply(event, addl, '<img src="mxc://possum.city/b4Vo1BTcq49B7TbFWCqq76HQWQEdNIqq" alt="nuh uh" /><br>' + addl);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue