Translator Test

This commit is contained in:
Daniel Odendahl Jr
2017-03-22 16:27:42 +00:00
parent 688a21f432
commit 016ce5f6fd
2 changed files with 78 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
const commando = require('discord.js-commando');
const translator = require('../../src/translatetest.js');
module.exports = class TranslatorCommand extends commando.Command {
constructor(Client){
super(Client, {
name: 'translatetest',
group: 'util',
memberName: 'translatetest',
description: "A test for a custom translator.",
examples: [";servers"]
});
}
hasPermission(msg) {
return this.client.isOwner(msg.author);
}
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 thingToTranslate = message.content.split(" ").slice(1).join(" ");
let translated = translator.translate(thingToTranslate);
message.channel.send(translated);
}
};