Files
xiao/commands/textedit/pirate.js
T
Daniel Odendahl Jr 122fcf5de3 Proper await
2017-03-24 02:29:31 +00:00

39 lines
1.3 KiB
JavaScript

const commando = require('discord.js-commando');
const pirateSpeak = require('pirate-speak');
module.exports = class PirateCommand extends commando.Command {
constructor(Client) {
super(Client, {
name: 'pirate',
aliases: [
'piratespeak',
'yarr'
],
group: 'textedit',
memberName: 'pirate',
description: 'Talk like a pirate! (;pirate This is being said like a pirate!)',
examples: [';pirate This is being said like a pirate!']
});
}
async run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let turnToPirate = message.content.split(" ").slice(1).join(" ");
let pirate = pirateSpeak.translate(turnToPirate);
if (!turnToPirate) {
message.channel.send(":x: Error! Nothing to translate!");
}
else {
if (pirate.length > 1950) {
message.channel.send(":x: Error! Your message is too long!");
}
else {
message.channel.send(pirate);
}
}
}
};