More Perm Checks, return in index

This commit is contained in:
Daniel Odendahl Jr
2017-05-08 02:26:57 +00:00
parent 9f09e23a07
commit d11500db59
7 changed files with 13 additions and 3 deletions
+2
View File
@@ -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;
+2
View File
@@ -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;
+2
View File
@@ -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;
+2
View File
@@ -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;
+2
View File
@@ -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;
+2 -2
View File
@@ -53,7 +53,7 @@ client.on('guildMemberAdd', (member) => {
.replace(/(<user>)/gi, member.user.username)
.replace(/(<server>)/gi, member.guild.name)
.replace(/(<mention>)/gi, member);
channel.send(msg);
return channel.send(msg);
});
client.on('guildMemberRemove', (member) => {
@@ -64,7 +64,7 @@ client.on('guildMemberRemove', (member) => {
.replace(/(<user>)/gi, member.user.username)
.replace(/(<server>)/gi, member.guild.name)
.replace(/(<mention>)/gi, member);
channel.send(msg);
return channel.send(msg);
});
client.on('guildCreate', async(guild) => {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "18.6.0",
"version": "18.6.1",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {