Attempt to Fix Bug

This commit is contained in:
Daniel Odendahl Jr
2017-08-21 21:29:48 +00:00
parent 8d6e964698
commit 91c4c30aee
7 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ module.exports = class BanCommand extends Command {
reason: `${msg.author.tag}: ${reason}` reason: `${msg.author.tag}: ${reason}`
}); });
await msg.say(`Successfully banned ${member.user.tag}.`); await msg.say(`Successfully banned ${member.user.tag}.`);
if (!modlogs) { if (!modlogs || !modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
return msg.say('Could not log the ban to the mod logs.'); return msg.say('Could not log the ban to the mod logs.');
} else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) { } else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
const embed = new MessageEmbed() const embed = new MessageEmbed()
+1 -1
View File
@@ -59,7 +59,7 @@ module.exports = class HackbanCommand extends Command {
return msg.say(`Could not ban the user: \`${err.message}\``); return msg.say(`Could not ban the user: \`${err.message}\``);
} }
await msg.say(`Successfully banned ${user.tag}.`); await msg.say(`Successfully banned ${user.tag}.`);
if (!modlogs) { if (!modlogs || !modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
return msg.say('Could not log the ban to the mod logs.'); return msg.say('Could not log the ban to the mod logs.');
} else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) { } else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
const embed = new MessageEmbed() const embed = new MessageEmbed()
+1 -1
View File
@@ -62,7 +62,7 @@ module.exports = class KickCommand extends Command {
} }
await member.kick(`${msg.author.tag}: ${reason}`); await member.kick(`${msg.author.tag}: ${reason}`);
await msg.say(`Successfully kicked ${member.user.tag}.`); await msg.say(`Successfully kicked ${member.user.tag}.`);
if (!modlogs) { if (!modlogs || !modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
return msg.say('Could not log the kick to the mod logs.'); return msg.say('Could not log the kick to the mod logs.');
} else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) { } else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
const embed = new MessageEmbed() const embed = new MessageEmbed()
+1 -1
View File
@@ -66,7 +66,7 @@ module.exports = class SoftbanCommand extends Command {
}); });
await msg.guild.unban(member.user, 'Softban'); await msg.guild.unban(member.user, 'Softban');
await msg.say(`Successfully softbanned ${member.user.tag}.`); await msg.say(`Successfully softbanned ${member.user.tag}.`);
if (!modlogs) { if (!modlogs || !modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
return msg.say('Could not log the softban to the mod logs.'); return msg.say('Could not log the softban to the mod logs.');
} else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) { } else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
const embed = new MessageEmbed() const embed = new MessageEmbed()
+1 -1
View File
@@ -60,7 +60,7 @@ module.exports = class WarnCommand extends Command {
await msg.say('Failed to Send DM.'); await msg.say('Failed to Send DM.');
} }
await msg.say(`Successfully warned ${member.user.tag}.`); await msg.say(`Successfully warned ${member.user.tag}.`);
if (!modlogs) { if (!modlogs || !modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
return msg.say('Could not log the warn to the mod logs.'); return msg.say('Could not log the warn to the mod logs.');
} else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) { } else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
const embed = new MessageEmbed() const embed = new MessageEmbed()
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class PortalSendCommand extends Command {
async run(msg, args) { async run(msg, args) {
const { message } = args; const { message } = args;
const channels = this.client.channels.filter(c => c.type === 'text' && c.guild.id !== msg.guild.id); const channels = this.client.channels.filter(c => c.guild.id !== msg.guild.id);
const channel = filterTopics(channels, 'portal').random(); const channel = filterTopics(channels, 'portal').random();
if (!channel) return msg.say('Aww... No channel has an open portal...'); if (!channel) return msg.say('Aww... No channel has an open portal...');
try { try {
+1 -3
View File
@@ -44,9 +44,7 @@ class Util {
static filterTopics(channels, setting) { static filterTopics(channels, setting) {
return channels.filter(c => { return channels.filter(c => {
if (c.type !== 'text') return false; if (c.type !== 'text' || !c.topic) return false;
if (!c.topic) return false;
if (!c.permissionsFor(c.client.user).has('SEND_MESSAGES')) return false;
if (c.topic.includes(`<${setting}>`)) return true; if (c.topic.includes(`<${setting}>`)) return true;
return false; return false;
}); });