mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 13:56:43 +02:00
Clean-Ups
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
@@ -10,6 +10,8 @@ module.exports = class WarnCommand extends Command {
|
||||
memberName: 'warn',
|
||||
description: 'Warns a user and logs the warn to the mod logs.',
|
||||
guildOnly: true,
|
||||
allowStaff: true,
|
||||
userPermissions: ['KICK_MEMBERS'],
|
||||
args: [
|
||||
{
|
||||
key: 'member',
|
||||
@@ -29,20 +31,13 @@ module.exports = class WarnCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
hasPermission(msg) {
|
||||
const staffRole = msg.guild.roles.get(msg.guild.settings.get('staffRole'));
|
||||
if (staffRole && !msg.member.roles.has(staffRole.id)) return `You do not have the ${staffRole.name} role.`;
|
||||
else if (!msg.member.hasPermission('KICK_MEMBERS')) return 'You do not have the `Kick Members` Permission.';
|
||||
else return true;
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if (!modlogs) return msg.say('This Command requires a channel set with the `mod-channel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
|
||||
return msg.say('This Command requires the `SEND_MESSAGES` Permission for the Mod Log Channel.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
return msg.say('This Command requires the `EMBED_LINKS` Permission for the Mod Log Channel.');
|
||||
const { member, reason } = args;
|
||||
if (!member.kickable) return msg.say('This member is not warnable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user