From 1d80e28aac0da59efc73fc29d3fb3925f893c29d Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 24 Feb 2018 11:56:04 -0500 Subject: Warn --- commands/ban.js | 4 ++-- commands/kick.js | 4 ++-- commands/purge.js | 7 +++++-- commands/softban.js | 4 ++-- commands/warn.js | 55 +++++++++++++++++++++++++++-------------------------- 5 files changed, 39 insertions(+), 35 deletions(-) diff --git a/commands/ban.js b/commands/ban.js index 69a78f6..8d794d2 100644 --- a/commands/ban.js +++ b/commands/ban.js @@ -1,6 +1,6 @@ exports.run = async (bot, msg, args) => { - if (!msg.member.hasPermission('BAN_MEMBERS')) return msg.reply('You don\'t have permssion to ban members'); - if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) return msg.reply('I don\'t have permssion to ban members'); + if (!msg.member.hasPermission('BAN_MEMBERS')) return msg.reply('You don\'t have permssion to ban members.'); + if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) return msg.reply('I don\'t have permssion to ban members.'); const member = msg.mentions.members.first(); if (!member) return await msg.reply('Who am I gonna ban?'); diff --git a/commands/kick.js b/commands/kick.js index 5ed7942..c371c21 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -1,6 +1,6 @@ exports.run = async (bot, msg, args) => { - if (!msg.member.hasPermission('KICK_MEMBERS')) return msg.reply('You don\'t have permssion to kick members'); - if (!msg.guild.member(bot.user).hasPermission('KICK_MEMBERS')) return msg.reply('I don\'t have permssion to kick members'); + if (!msg.member.hasPermission('KICK_MEMBERS')) return msg.reply('You don\'t have permssion to kick members.'); + if (!msg.guild.member(bot.user).hasPermission('KICK_MEMBERS')) return msg.reply('I don\'t have permssion to kick members.'); const member = msg.mentions.members.first(); if (!member) return await msg.reply('Who am I gonna kick?'); diff --git a/commands/purge.js b/commands/purge.js index 5ce24f8..a0e9541 100644 --- a/commands/purge.js +++ b/commands/purge.js @@ -1,12 +1,15 @@ exports.run = async (bot, msg, args) => { - if (!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You don\'t have permssion to manage messages'); - if (!msg.guild.member(bot.user).hasPermission('MANAGE_MESSAGES')) return msg.reply('I don\'t have permssion to manage messages'); + if (!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You don\'t have permssion to manage messages.'); + if (!msg.guild.member(bot.user).hasPermission('MANAGE_MESSAGES')) return msg.reply('I don\'t have permssion to manage messages.'); + const user = msg.mentions.users.first(); const amount = parseInt(args[0]) ? parseInt(args[0]) : parseInt(args[1]); + if (!amount) return msg.reply('How many message shall I delete?'); if (!amount && !user) return msg.reply('Tell me the user and amount or the just the amount of messages to purge.'); if (amount > 100 || amount < 3) return msg.reply('Choose an amount less than 98 and greater than 1'); msg.delete(); + let msgs = await msg.channel.fetchMessages({ limit: amount }); if (user) { const filterBy = user ? user.id : bot.user.id; diff --git a/commands/softban.js b/commands/softban.js index b942b3e..d17b8c1 100644 --- a/commands/softban.js +++ b/commands/softban.js @@ -1,6 +1,6 @@ exports.run = async (bot, msg, args) => { - if (!msg.member.hasPermission('BAN_MEMBERS')) return msg.reply('You don\'t have permssion to ban members'); - if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) return msg.reply('I don\'t have permssion to ban members'); + if (!msg.member.hasPermission('BAN_MEMBERS')) return msg.reply('You don\'t have permssion to ban members.'); + if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) return msg.reply('I don\'t have permssion to ban members.'); const member = msg.mentions.members.first(); if (!member) return await msg.reply('Who am I gonna softban?'); diff --git a/commands/warn.js b/commands/warn.js index 0e9e966..9fc2272 100644 --- a/commands/warn.js +++ b/commands/warn.js @@ -1,30 +1,31 @@ exports.run = (bot, msg, args) => { - if (!message.member.permissions.has("MANAGE_MESSAGES")) return message.channel.send(':warning: You cannot warn members due to your permission level.'); - let warnReason = args.slice(1); - var victim = message.mentions.users.first(); + if (!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You don\'t have permssion to warn.'); + const warnReason = args.slice(1); + const victim = msg.mentions.users.first(); - message.channel.send(`Successfully logged ${victim.user.tag}'s warning.`) + msg.channel.send(`Successfully logged ${victim.user.tag}'s warning.`); - bot.channels.find('name', 'logs').send( - new Discord.RichEmbed() - .setColor(0x00ae86) - .setTitle('Warning') - .addField('ID', victim.id, true) - .addField('Created Account', victim.user.createdAt, true) - .addField('Warning Reason', warnReason) - .setTimestamp() - .setFooter('Warned by: ' + message.author.user.tag, message.author.user.avatarURL) - ); - }; - - exports.conf = { - aliases: [], - guildOnly: true, - }; - - exports.help = { - name: 'warn', - description: 'Logs a warning to the user.', - category: 'Moderation', - }; - \ No newline at end of file + const { RichEmbed } = require('discord.js'); + bot.channels.find('name', 'logs').send( + new RichEmbed() + .setColor(0x00ae86) + .setTitle('Warning') + .addField('ID', victim.id, true) + .addField('Created Account', victim.user.createdAt, true) + .addField('Warning Reason', warnReason) + .setTimestamp() + .setFooter('Warned by: ' + msg.author.user.tag, msg.author.user.avatarURL) + ); +}; + +exports.conf = { + aliases: [], + guildOnly: true, +}; + +exports.help = { + name: 'warn', + description: 'Logs a warning to the user.', + usage : '@ ', + category: 'Moderation', +}; -- cgit v1.2.3