woomy/src/commands/yoda.js

33 lines
924 B
JavaScript
Raw Normal View History

2020-03-26 04:31:32 +00:00
const fetch = require("node-fetch")
2020-03-11 20:47:06 +00:00
exports.run = async (client, message, args) => {
2020-03-16 01:14:33 +00:00
const speech = args.join(' ');
if (!speech) {
return message.channel.send(`<:error:466995152976871434> Please include text for me to convert to yodish. Yes.`)
};
message.channel.startTyping();
try{
2020-03-26 04:31:32 +00:00
fetch(`http://yoda-api.appspot.com/api/v1/yodish?text=${encodeURIComponent(speech.toLowerCase())}`)
.then(res => res.json())
.then(json => message.channel.send(json.yodish));
message.channel.stopTyping();
2020-03-16 01:14:33 +00:00
} catch(err) {
2020-03-26 04:31:32 +00:00
message.channel.send(`<:error:466995152976871434> An error has occurred: ${err}`);
2020-03-16 01:14:33 +00:00
message.channel.stopTyping();
};
};
2020-03-11 20:47:06 +00:00
exports.conf = {
2020-03-26 04:31:32 +00:00
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User",
requiredPerms: []
};
2020-03-11 20:47:06 +00:00
exports.help = {
2020-03-26 04:31:32 +00:00
name: "yoda",
category: "Fun",
description: "Turns any text you input into yodish. Yes.",
usage: "yoda <text>"
};