From 4c415ecf8ada9ccfdcafeac7090b1c7fb0413464 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Tue, 23 Mar 2021 10:02:03 -0600 Subject: [PATCH] secure dev commands --- commands/dev/admin.js | 2 +- commands/dev/developer.js | 2 +- commands/dev/staff.js | 2 +- commands/dev/support.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/dev/admin.js b/commands/dev/admin.js index bed5272..792ab1c 100644 --- a/commands/dev/admin.js +++ b/commands/dev/admin.js @@ -23,7 +23,7 @@ module.exports = { if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as an admin.");} if (!person) {return message.reply("You must mention someone to add as an admin, or use their ID.");} let atu = await UserData.findOne({uid: message.author.id}); - if (!atu && !atu.developer && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add set admin statuses.');} + if ((!atu || !atu.developer) && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add set admin statuses.');} if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true; tu.admin = true;} else {tu.admin = false; tu.developer = false;} tu.save(); diff --git a/commands/dev/developer.js b/commands/dev/developer.js index 1433e07..1dc2c7e 100644 --- a/commands/dev/developer.js +++ b/commands/dev/developer.js @@ -25,7 +25,7 @@ module.exports = { if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a developer.");} if (!person) {return message.reply("You must mention someone to add as a developer, or use their ID.");} let atu = await UserData.findOne({uid: message.author.id}); - if (!atu && !atu.developer && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add or remove someone else as a developer.');} + if ((!atu || !atu.developer) && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add or remove someone else as a developer.');} if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true; tu.admin = true; tu.developer = true;} else {tu.developer = false;} tu.save(); diff --git a/commands/dev/staff.js b/commands/dev/staff.js index 4fd864a..d85a58c 100644 --- a/commands/dev/staff.js +++ b/commands/dev/staff.js @@ -23,7 +23,7 @@ module.exports = { if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a Staff Member.");} if (!person) {return message.reply("You must mention someone to add as a staff member, or use their ID.");} let atu = await UserData.findOne({uid: message.author.id}); - if (!atu && !atu.developer && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add set staff member statuses.');} + if ((!atu || !atu.developer) && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add set staff member statuses.');} if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true;} else {tu.staff = false; tu.admin = false; tu.developer = false;} tu.save(); diff --git a/commands/dev/support.js b/commands/dev/support.js index b851228..bf281e9 100644 --- a/commands/dev/support.js +++ b/commands/dev/support.js @@ -23,7 +23,7 @@ module.exports = { if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a Support Team Member.");} if (!person) {return message.reply("You must mention someone to add as a support member, or use their ID.");} let atu = await UserData.findOne({uid: message.author.id}); - if (!atu && !atu.admin) {return message.reply('You must be an admin in order to add set support team member statuses.');} + if (!atu || !atu.admin) {return message.reply('You must be an admin in order to add set support team member statuses.');} if (['a', 'add'].includes(args[0])) {tu.support = true;} else {tu.support = false; tu.staff = false; tu.admin = false; tu.developer = false;} tu.save();