Files
xiao/commands/textedit/pirate.js
T
Daniel Odendahl Jr e2a4a92990 args and more
2017-03-25 04:16:27 +00:00

35 lines
1.2 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!'],
args: [{
key: 'text',
prompt: 'What text would you like to convert to pirate?',
type: 'string'
}]
});
}
run(message, args) {
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 = args.text;
let pirate = pirateSpeak.translate(turnToPirate);
if (pirate.length > 1950) return message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(pirate);
}
};