From d11500db59727f8853493c030577143b756116c0 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Mon, 8 May 2017 02:26:57 +0000 Subject: [PATCH] More Perm Checks, return in index --- commands/moderation/ban.js | 2 ++ commands/moderation/kick.js | 2 ++ commands/moderation/softban.js | 2 ++ commands/moderation/unban.js | 2 ++ commands/moderation/warn.js | 2 ++ index.js | 4 ++-- package.json | 2 +- 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/commands/moderation/ban.js b/commands/moderation/ban.js index 098d1706..7ac5117d 100644 --- a/commands/moderation/ban.js +++ b/commands/moderation/ban.js @@ -41,6 +41,8 @@ module.exports = class BanCommand extends Command { return msg.say('This Command requires the `Ban Members` Permission.'); 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')) + 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.'); const { member, reason } = args; diff --git a/commands/moderation/kick.js b/commands/moderation/kick.js index a40b3569..94e7f524 100644 --- a/commands/moderation/kick.js +++ b/commands/moderation/kick.js @@ -38,6 +38,8 @@ module.exports = class KickCommand extends Command { return msg.say('This Command requires the `Kick Members` Permission.'); 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')) + 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.'); const { member, reason } = args; diff --git a/commands/moderation/softban.js b/commands/moderation/softban.js index b81f0139..ea737128 100644 --- a/commands/moderation/softban.js +++ b/commands/moderation/softban.js @@ -40,6 +40,8 @@ module.exports = class SoftbanCommand extends Command { return msg.say('This Command requires the `Kick Members` Permission.'); 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')) + 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.'); const { member, reason } = args; diff --git a/commands/moderation/unban.js b/commands/moderation/unban.js index 405ce433..72b9bbe9 100644 --- a/commands/moderation/unban.js +++ b/commands/moderation/unban.js @@ -45,6 +45,8 @@ module.exports = class UnbanCommand extends Command { return msg.say('This Command requires the `Ban Members` Permission.'); 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')) + 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.'); const { id, reason } = args; diff --git a/commands/moderation/warn.js b/commands/moderation/warn.js index 6523989d..f532b081 100644 --- a/commands/moderation/warn.js +++ b/commands/moderation/warn.js @@ -36,6 +36,8 @@ module.exports = class WarnCommand extends Command { 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')) + 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.'); const { member, reason } = args; diff --git a/index.js b/index.js index 269b37fa..ac0aee90 100644 --- a/index.js +++ b/index.js @@ -53,7 +53,7 @@ client.on('guildMemberAdd', (member) => { .replace(/()/gi, member.user.username) .replace(/()/gi, member.guild.name) .replace(/()/gi, member); - channel.send(msg); + return channel.send(msg); }); client.on('guildMemberRemove', (member) => { @@ -64,7 +64,7 @@ client.on('guildMemberRemove', (member) => { .replace(/()/gi, member.user.username) .replace(/()/gi, member.guild.name) .replace(/()/gi, member); - channel.send(msg); + return channel.send(msg); }); client.on('guildCreate', async(guild) => { diff --git a/package.json b/package.json index 07251626..57b7db42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "18.6.0", + "version": "18.6.1", "description": "A Discord Bot", "main": "shardingmanager.js", "scripts": {