Fix the Mod Commands

This commit is contained in:
Daniel Odendahl Jr
2017-05-22 23:02:27 +00:00
parent 7ba48446b3
commit 3c98fad04d
5 changed files with 18 additions and 9 deletions
+2 -2
View File
@@ -47,12 +47,12 @@ module.exports = class BanCommand extends Command {
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
try {
try {
await member.send(stripIndents`
await member.user.send(stripIndents`
You were banned from ${msg.guild.name}!
Reason: ${reason}.
`);
} catch (err) {
await msg.say('Failed to send DM to the user.');
await msg.say('Failed to Send DM.');
}
await member.ban({ days: 7, reason });
msg.say(':ok_hand:');
+2 -2
View File
@@ -46,12 +46,12 @@ module.exports = class KickCommand extends Command {
if (!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
try {
try {
await member.send(stripIndents`
await member.user.send(stripIndents`
You were kicked from ${msg.guild.name}!
Reason: ${reason}.
`);
} catch (err) {
await msg.say('Failed to send DM.');
await msg.say('Failed to Send DM.');
}
await member.kick({ reason });
msg.say(':ok_hand:');
+3 -3
View File
@@ -46,15 +46,15 @@ module.exports = class SoftbanCommand extends Command {
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { member, reason } = args;
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
if (!member.bannable) return msg.say('This member is not softbannable. Perhaps they have a higher role than me?');
try {
try {
await member.send(stripIndents`
await member.user.send(stripIndents`
You were softbanned from ${msg.guild.name}!
Reason: ${reason}.
`);
} catch (err) {
await msg.say('Failed to send DM to user.');
await msg.say('Failed to Send DM.');
}
await member.ban({ days: 7, reason });
await msg.guild.unban(member.user);
+10 -1
View File
@@ -33,7 +33,7 @@ module.exports = class WarnCommand extends Command {
return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole'));
}
run(msg, args) {
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.permissionsFor(this.client.user).has('SEND_MESSAGES'))
@@ -41,6 +41,15 @@ module.exports = class WarnCommand extends Command {
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { member, reason } = args;
if (!member.kickable) return msg.say('This member is not warnable. Perhaps they have a higher role than me?');
try {
await member.user.send(stripIndents`
You were warned in ${msg.guild.name}!
Reason: ${reason}.
`);
} catch (err) {
await msg.say('Failed to Send DM.');
}
msg.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "19.12.0",
"version": "19.12.1",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {