Remove Mod DM

This commit is contained in:
Daniel Odendahl Jr
2017-08-29 12:58:09 +00:00
parent de88600166
commit 532cbea7ed
5 changed files with 12 additions and 30 deletions
+3 -7
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const { stripIndents } = require('common-tags'); const { stripIndents } = require('common-tags');
const { filterTopics, parseTopic } = require('../../structures/Util'); const { filterTopics } = require('../../structures/Util');
module.exports = class BanCommand extends Command { module.exports = class BanCommand extends Command {
constructor(client) { constructor(client) {
@@ -49,16 +49,12 @@ module.exports = class BanCommand extends Command {
}); });
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.'); if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
try { try {
const message = parseTopic(modlogs.topic, 'modmessage')
.replace(/{{action}}/gi, 'banned')
.replace(/{{moderator}}/gi, msg.author.tag)
.replace(/{{server}}/gi, msg.guild.name);
await member.send(stripIndents` await member.send(stripIndents`
${message || `You were banned from ${msg.guild.name} by ${msg.author.tag}!`} You were banned from ${msg.guild.name} by ${msg.author.tag}!
**Reason:** ${reason} **Reason:** ${reason}
`); `);
} catch (err) { } catch (err) {
await msg.say('Failed to Send DM.'); await msg.say('Failed to send DM.');
} }
await member.ban({ await member.ban({
days: 7, days: 7,
+3 -7
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const { stripIndents } = require('common-tags'); const { stripIndents } = require('common-tags');
const { filterTopics, parseTopic } = require('../../structures/Util'); const { filterTopics } = require('../../structures/Util');
module.exports = class KickCommand extends Command { module.exports = class KickCommand extends Command {
constructor(client) { constructor(client) {
@@ -49,16 +49,12 @@ module.exports = class KickCommand extends Command {
}); });
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.'); if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
try { try {
const message = parseTopic(modlogs.topic, 'modmessage')
.replace(/{{action}}/gi, 'kicked')
.replace(/{{moderator}}/gi, msg.author.tag)
.replace(/{{server}}/gi, msg.guild.name);
await member.send(stripIndents` await member.send(stripIndents`
${message || `You were kicked from ${msg.guild.name} by ${msg.author.tag}!`} You were kicked from ${msg.guild.name} by ${msg.author.tag}!
**Reason:** ${reason} **Reason:** ${reason}
`); `);
} catch (err) { } catch (err) {
await msg.say('Failed to Send DM.'); await msg.say('Failed to send DM.');
} }
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}.`);
+3 -7
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const { stripIndents } = require('common-tags'); const { stripIndents } = require('common-tags');
const { filterTopics, parseTopic } = require('../../structures/Util'); const { filterTopics } = require('../../structures/Util');
module.exports = class SoftbanCommand extends Command { module.exports = class SoftbanCommand extends Command {
constructor(client) { constructor(client) {
@@ -49,16 +49,12 @@ module.exports = class SoftbanCommand extends Command {
}); });
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.'); if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
try { try {
const message = parseTopic(modlogs.topic, 'modmessage')
.replace(/{{action}}/gi, 'softbanned')
.replace(/{{moderator}}/gi, msg.author.tag)
.replace(/{{server}}/gi, msg.guild.name);
await member.send(stripIndents` await member.send(stripIndents`
${message || `You were softbanned from ${msg.guild.name} by ${msg.author.tag}!`} You were softbanned from ${msg.guild.name} by ${msg.author.tag}!
**Reason:** ${reason} **Reason:** ${reason}
`); `);
} catch (err) { } catch (err) {
await msg.say('Failed to Send DM.'); await msg.say('Failed to send DM.');
} }
await member.ban({ await member.ban({
days: 7, days: 7,
+3 -7
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const { stripIndents } = require('common-tags'); const { stripIndents } = require('common-tags');
const { filterTopics, parseTopic } = require('../../structures/Util'); const { filterTopics } = require('../../structures/Util');
module.exports = class WarnCommand extends Command { module.exports = class WarnCommand extends Command {
constructor(client) { constructor(client) {
@@ -48,16 +48,12 @@ module.exports = class WarnCommand extends Command {
}); });
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.'); if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
try { try {
const message = parseTopic(modlogs.topic, 'modmessage')
.replace(/{{action}}/gi, 'warned')
.replace(/{{moderator}}/gi, msg.author.tag)
.replace(/{{server}}/gi, msg.guild.name);
await member.send(stripIndents` await member.send(stripIndents`
${message || `You were warned in ${msg.guild.name} by ${msg.author.tag}!`} You were warned in ${msg.guild.name} by ${msg.author.tag}!
**Reason:** ${reason} **Reason:** ${reason}
`); `);
} catch (err) { } catch (err) {
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 || !modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) { if (!modlogs || !modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
-2
View File
@@ -20,11 +20,9 @@ module.exports = class SettingHelpCommand extends Command {
**Member Log Channel:** Place \`<memberlog>\` in a channel's topic. **Member Log Channel:** Place \`<memberlog>\` in a channel's topic.
**Custom Join Message:** Place \`<joinmessage>message</joinmessage>\` in the Member Log's topic. **Custom Join Message:** Place \`<joinmessage>message</joinmessage>\` in the Member Log's topic.
**Custom Leave Message:** Place \`<leavemessage>message</leavemessage>\` in the Member Log's topic. **Custom Leave Message:** Place \`<leavemessage>message</leavemessage>\` in the Member Log's topic.
**Custom Mod DM:** Place \`<modmessage>message</modmessage>\` in the Mod Log's topic.
__**Placeholders**__ __**Placeholders**__
**Join/Leave Message:** \`{{member}}\`, \`{{server}}\`, \`{{mention}}\` **Join/Leave Message:** \`{{member}}\`, \`{{server}}\`, \`{{mention}}\`
**Mod DM:** \`{{action}}\`, \`{{server}}\`, \`{{moderator}}\`
`); `);
} }
}; };