stripIndents

This commit is contained in:
Daniel Odendahl Jr
2017-05-03 01:19:44 +00:00
parent 74fa836044
commit 2ee1f3e594
15 changed files with 100 additions and 79 deletions
+9 -8
View File
@@ -1,5 +1,6 @@
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const { stripIndents } = require('common-tags');
module.exports = class BanCommand extends Command {
constructor(client) {
@@ -50,10 +51,10 @@ module.exports = class BanCommand extends Command {
return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
try {
try {
await member.send(
`You were banned from ${msg.guild.name}!
Reason: ${reason}.`
);
await member.send(stripIndents`
You were banned from ${msg.guild.name}!
Reason: ${reason}.
`);
} catch (err) {
await msg.say('Failed to send DM to user.');
}
@@ -66,11 +67,11 @@ module.exports = class BanCommand extends Command {
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0xFF0000)
.setTimestamp()
.setDescription(
`**Member:** ${member.user.tag} (${member.id})
.setDescription(stripIndents`
**Member:** ${member.user.tag} (${member.id})
**Action:** Ban
**Reason:** ${reason}`
);
**Reason:** ${reason}
`);
return modlogs.send({embed});
} catch (err) {
return msg.say('An Unknown Error Occurred.');
+9 -8
View File
@@ -1,5 +1,6 @@
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const { stripIndents } = require('common-tags');
module.exports = class KickCommand extends Command {
constructor(client) {
@@ -47,10 +48,10 @@ module.exports = class KickCommand extends Command {
return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
try {
try {
await member.send(
`You were kicked from ${msg.guild.name}!
Reason: ${reason}.`
);
await member.send(stripIndents`
You were kicked from ${msg.guild.name}!
Reason: ${reason}.
`);
} catch (err) {
await msg.say('Failed to send DM.');
}
@@ -62,11 +63,11 @@ module.exports = class KickCommand extends Command {
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0xFFA500)
.setTimestamp()
.setDescription(
`**Member:** ${member.user.tag} (${member.id})
.setDescription(stripIndents`
**Member:** ${member.user.tag} (${member.id})
**Action:** Kick
**Reason:** ${reason}`
);
**Reason:** ${reason}
`);
return modlogs.send({embed});
} catch (err) {
return msg.say('An Unknown Error Occurred.');
+9 -8
View File
@@ -1,5 +1,6 @@
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const { stripIndents } = require('common-tags');
module.exports = class SoftbanCommand extends Command {
constructor(client) {
@@ -49,10 +50,10 @@ module.exports = class SoftbanCommand extends Command {
return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
try {
try {
await member.send(
`You were softbanned from ${msg.guild.name}!
Reason: ${reason}.`
);
await member.send(stripIndents`
You were softbanned from ${msg.guild.name}!
Reason: ${reason}.
`);
} catch (err) {
await msg.say('Failed to send DM to user.');
}
@@ -66,11 +67,11 @@ module.exports = class SoftbanCommand extends Command {
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0xFF4500)
.setTimestamp()
.setDescription(
`**Member:** ${member.user.tag} (${member.id})
.setDescription(stripIndents`
**Member:** ${member.user.tag} (${member.id})
**Action:** Softban
**Reason:** ${reason}`
);
**Reason:** ${reason}
`);
return modlogs.send({embed});
} catch (err) {
return msg.say('An Unknown Error Occurred.');
+5 -4
View File
@@ -1,5 +1,6 @@
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const { stripIndents } = require('common-tags');
module.exports = class UnbanCommand extends Command {
constructor(client) {
@@ -61,11 +62,11 @@ module.exports = class UnbanCommand extends Command {
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0x00AE86)
.setTimestamp()
.setDescription(
`**Member:** ${member.tag} (${member.id})
.setDescription(stripIndents`
**Member:** ${member.tag} (${member.id})
**Action:** Unban
**Reason:** ${reason}`
);
**Reason:** ${reason}
`);
return modlogs.send({embed});
} catch (err) {
return msg.say('An Unknown Error Occurred.');
+5 -4
View File
@@ -1,5 +1,6 @@
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const { stripIndents } = require('common-tags');
module.exports = class WarnCommand extends Command {
constructor(client) {
@@ -46,11 +47,11 @@ module.exports = class WarnCommand extends Command {
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0xFFFF00)
.setTimestamp()
.setDescription(
`**Member:** ${member.user.tag} (${member.id})
.setDescription(stripIndents`
**Member:** ${member.user.tag} (${member.id})
**Action:** Warn
**Reason:** ${reason}`
);
**Reason:** ${reason}
`);
return modlogs.send({embed});
} catch (err) {
return msg.say('An Unknown Error Occurred.');