From 0b83136fbe80773be70c0bb56bdd26cfc86e15fc Mon Sep 17 00:00:00 2001 From: Neko Life Date: Sun, 16 May 2021 09:26:00 +0000 Subject: [PATCH] update permissions --- cmds/utility/newquoteotd.js | 3 ++- cmds/utility/quoteotd.js | 3 ++- cmds/utility/say.js | 8 ++++++-- cmds/utility/send.js | 9 +++++++-- cmds/utility/servav.js | 13 +++++++++---- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/cmds/utility/newquoteotd.js b/cmds/utility/newquoteotd.js index a3d86fc..48cfabf 100644 --- a/cmds/utility/newquoteotd.js +++ b/cmds/utility/newquoteotd.js @@ -13,7 +13,8 @@ module.exports = class newquoteotd extends commando.Command { memberName: "newquoteotd", group: "utility", description: "The Life exclusive command for Quote of the day.", - guildOnly: true + guildOnly: true, + userPermissions:"ADMINISTRATOR" }); } async run(msg, arg) { diff --git a/cmds/utility/quoteotd.js b/cmds/utility/quoteotd.js index ea355c0..7b588b9 100644 --- a/cmds/utility/quoteotd.js +++ b/cmds/utility/quoteotd.js @@ -15,7 +15,8 @@ module.exports = class quoteotd extends commando.Command { group: "utility", description: "Set Quote of the day channel and settings.", details:"```\n--channel\n--text\n--icon```", - guildOnly: true + guildOnly: true, + userPermissions:"ADMINISTRATOR" }); } async run(msg, arg) { diff --git a/cmds/utility/say.js b/cmds/utility/say.js index 119cde9..6ea45da 100644 --- a/cmds/utility/say.js +++ b/cmds/utility/say.js @@ -17,8 +17,12 @@ module.exports = class say extends commando.Command { if (!args) { args = noArgs; } - trySend(this.client, msg, args); - if (args !== noArgs && msg.channel.guild) { + const sendThis = {content:args, disableMentions:"all"}; + if (msg.member?.hasPermission("ADMINISTRATOR")) { + sendThis.disableMentions = "none"; + } + trySend(this.client, msg, sendThis); + if (args !== noArgs && msg.channel.guild && msg.member.hasPermission("MANAGE_MESSAGES")) { tryDelete(msg); } return ranLog(msg,'say',`Content: ${args}`); diff --git a/cmds/utility/send.js b/cmds/utility/send.js index 54df3d4..7779cde 100644 --- a/cmds/utility/send.js +++ b/cmds/utility/send.js @@ -8,7 +8,8 @@ module.exports = class send extends commando.Command { name: "send", memberName: "send", group: "utility", - description: "Send message to designated channel." + description: "Send message to designated channel.", + userPermissions:"MANAGE_MESSAGES" }); } async run(msg, args ) { @@ -30,7 +31,11 @@ module.exports = class send extends commando.Command { if (sendTheMes.length === 0) { return trySend(this.client, at, `<@!${msg.author.id}> If you wanna send nothin then why you even typed that <:bruhLife:798789686242967554>`); } - const send = await channel.send(sendTheMes); + const sendThis = {content:sendTheMes, disableMentions:"all"}; + if (msg.member?.hasPermission("ADMINISTRATOR")) { + sendThis.disableMentions = "none"; + } + const send = await trySend(this.client, msg, sendThis); sentAdCheck(send); const filter = () => true; const collector = send.createReactionCollector(filter, {time: 15*6*1000, dispose:true}); diff --git a/cmds/utility/servav.js b/cmds/utility/servav.js index 88d9059..e432121 100644 --- a/cmds/utility/servav.js +++ b/cmds/utility/servav.js @@ -9,13 +9,18 @@ const getColor = require("../../resources/getColor"); module.exports = class servav extends commando.Command { constructor(client) { super(client, { - name: "servav", - memberName: "servav", - aliases: ["serveravatar", "servavatar", "serverav"], + name: "serv-av", + memberName: "serv-av", + aliases: ["server-avatar", "serv-avatar", "server-av"], group: "utility", description: "Show server avatar." }); } + /** + * + * @param {commando.CommandoMessage} msg + * @param {*} arg + */ run(msg, arg) { const server_ID = arg.split(/ +/)[0]; const doc = msg.guild?.id ?? msg.author.id; @@ -26,7 +31,7 @@ module.exports = class servav extends commando.Command { } const footerQuote = res?.["settings"]?.defaultEmbed?.footerQuote; let icon, target; - if (server_ID) { + if (server_ID && this.client.owners.includes(msg.author.id)) { if (!/\D/.test(server_ID)) { target = this.client.guilds.cache.get(server_ID); } else {