Files
xiao/commands/textedit/say.js
T
Daniel Odendahl Jr 7c0a39ec5c return and await
2017-03-23 13:16:59 +00:00

40 lines
1.2 KiB
JavaScript

const commando = require('discord.js-commando');
module.exports = class SayCommand extends commando.Command {
constructor(Client) {
super(Client, {
name: 'say',
aliases: [
'copy',
'repeat',
'parrot',
'echo'
],
group: 'textedit',
memberName: 'say',
description: 'Make XiaoBot say what you wish. (;say I can talk!)',
examples: [';say I can talk!']
});
}
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 copycat = message.content.split(" ").slice(1).join(" ");
if (!copycat) {
return message.channel.send(":x: Error! Nothing to say!");
}
else {
if (message.channel.type === 'dm') {
return message.channel.send(copycat);
}
else {
await message.delete();
return message.channel.send(copycat);
}
}
}
};