Remove Yoda Command (API is too Slow)

This commit is contained in:
Daniel Odendahl Jr
2017-04-16 15:55:30 +00:00
parent 98e371514b
commit 56af47e839
6 changed files with 6 additions and 46 deletions
-38
View File
@@ -1,38 +0,0 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
module.exports = class YodaCommand extends Command {
constructor(client) {
super(client, {
name: 'yoda',
group: 'textedit',
memberName: 'yoda',
description: 'Converts text to Yoda Speak. (;yoda This is Yoda.)',
examples: [';yoda This is Yoda.'],
args: [{
key: 'text',
prompt: 'What text would you like to convert to Yoda speak?',
type: 'string'
}]
});
}
async run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const text = encodeURIComponent(args.text);
try {
const response = await snekfetch
.get(`https://yoda.p.mashape.com/yoda?sentence=${text}`)
.set({
'X-Mashape-Key': process.env.MASHAPE_KEY,
'Accept': 'text/plain'
});
return message.say(`\u180E${response.text}`);
}
catch (err) {
return message.say(':x: Error! Something went wrong!');
}
}
};