perm check

This commit is contained in:
Neko-Life 2021-08-04 20:47:33 +07:00
parent 364f6e9883
commit d278a47bb7
4 changed files with 17 additions and 12 deletions

View file

@ -15,9 +15,7 @@ module.exports = class ban extends commando.Command {
memberName: "ban",
group: "moderation",
description: "Ban pesky troll and toxic members",
guildOnly: true,
userPermissions: ["BAN_MEMBERS"],
clientPermissions: ["BAN_MEMBERS"]
guildOnly: true
});
}
@ -27,6 +25,9 @@ module.exports = class ban extends commando.Command {
* @returns
*/
async run(msg, arg) {
const CL = msg.guild.member(msg.client.user);
if (!(msg.member.idAdmin || msg.member.hasPermission("BAN_MEMBER"))) return trySend(msg.client, msg, "bruh moment <:nekokekLife:852865942530949160>");
if (!(CL.idAdmin || CL.hasPermission("BAN_MEMBER"))) return trySend(msg.client, msg, "I don't have the power to do that <:pepewhysobLife:853237646666891274>");
if (!arg) return trySend(msg.client, msg,
"Args: `user_[name|mention|ID] -- [reason] -- [duration] [--d [number of days to delete messages of the user to ban]]`. Separate `user` with `,`. Example:" +
`\`\`\`js\n${msg.guild.commandPrefix + this.name

View file

@ -55,9 +55,7 @@ module.exports = class mute extends commando.Command {
`You can view server as the newly created mute role and override my default settings later.\n` +
`Example:\`\`\`\n--s -r muted -d 69y420mo36w49d69h4m420s\n` +
`--s -r none -d 0\n--cmr -n Muted -c black\`\`\``,
guildOnly: true,
userPermissions: ['MANAGE_ROLES'],
clientPermissions: ['MANAGE_ROLES']
guildOnly: true
});
}
/**
@ -66,6 +64,9 @@ module.exports = class mute extends commando.Command {
* @returns
*/
async run(msg, arg) {
const CL = msg.guild.member(msg.client.user);
if (!(msg.member.idAdmin || msg.member.hasPermission("MANAGE_ROLES"))) return trySend(msg.client, msg, "Who are you <:nekohmLife:846371737644957786>");
if (!(CL.idAdmin || CL.hasPermission("MANAGE_ROLES"))) return trySend(msg.client, msg, "I don't have the power to do that <:pepewhysobLife:853237646666891274>");
msg.channel.startTyping();
if (!msg.guild.DB) await msg.guild.dbLoad();
const MOD = msg.guild.DB.settings,

View file

@ -9,12 +9,14 @@ module.exports = class unbanCmd extends commando.Command {
memberName: "unban",
group: "moderation",
description: "Unban user from your server",
userPermissions: ["ADMINISTRATOR"],
clientPermissions: ["ADMINISTRATOR"]
guildOnly: true
});
}
async run(msg, arg) {
const CL = msg.guild.member(msg.client.user);
if (!(msg.member.idAdmin || msg.member.hasPermission("ADMINISTRATOR"))) return trySend(msg.client, msg, "are they your friend? <:nekokekLife:852865942530949160>");
if (!(CL.idAdmin || CL.hasPermission("ADMINISTRATOR"))) return trySend(msg.client, msg, "I don't have the power to do that <:pepewhysobLife:853237646666891274>");
if (!arg) return trySend(msg.client, msg, "Provide `user_ID` to unban. Separate `user` with `,`. Example:```js\n" +
`${msg.guild.commandPrefix + this.name} 757453290714824844, 706039105540194314, 198558078508072960 ` +
`-- sent me some nice materials for tonight\`\`\``);

View file

@ -1,7 +1,7 @@
'use strict';
const commando = require("@iceprod/discord.js-commando");
const { parseDoubleDash, trySend, defaultImageEmbed, parseComa, defaultEventLogEmbed } = require("../../resources/functions");
const { parseDoubleDash, trySend, parseComa, defaultEventLogEmbed } = require("../../resources/functions");
const targetUser = require("./src/targetUser");
module.exports = class unmute extends commando.Command {
@ -11,13 +11,14 @@ module.exports = class unmute extends commando.Command {
memberName: "unmute",
group: "moderation",
description: "Mute.",
guildOnly: true,
userPermissions: ['MANAGE_ROLES'],
clientPermissions: ['MANAGE_ROLES']
guildOnly: true
});
}
async run(msg, arg) {
const CL = msg.guild.member(msg.client.user);
if (!(msg.member.idAdmin || msg.member.hasPermission("MANAGE_ROLES"))) return trySend(msg.client, msg, "no <:nekohmLife:846371737644957786>");
if (!(CL.idAdmin || CL.hasPermission("MANAGE_ROLES"))) return trySend(msg.client, msg, "I don't have the power to do that <:pepewhysobLife:853237646666891274>");
if (!msg.guild.DB) await msg.guild.dbLoad();
msg.channel.startTyping();
if (!arg) return trySend(msg.client, msg, "Provide `user_ID` to unmute. Separate `user` with `,`. Example:```js\n" +