Merge pull request #5 from Terryiscool160/master

Yoda command n other cool stuff
This commit is contained in:
Emily 2020-03-11 21:59:13 +00:00 committed by GitHub
commit 9be16b793e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 2 deletions

View file

@ -1,3 +1,4 @@
Added a yodish command and made catfact and dogfact say if the api errors (terry)
Links to avatars now lead to the original file size
Bots now get a bot badge in the userinfo command
Added dogfact and catfact command (terry)

View file

@ -1,10 +1,16 @@
const request = require("request");
exports.run = async (bot, message, args) => {
message.channel.startTyping();
try{
request({ uri: "https://catfact.ninja/facts", json: true }, (error, response, body) => {
if (error) throw new Error(error);
message.channel.send(`**Did you know?**\n ${body.data[0].fact}`);
message.channel.startTyping();
});
} catch(err) {
message.channel.send(`<:error:466995152976871434> API error: ${err}`);
message.channel.stopTyping();
};
};
exports.conf = {

View file

@ -1,10 +1,16 @@
const request = require("request");
exports.run = async (bot, message, args) => {
message.channel.startTyping();
try{
request({ uri: "https://dog-api.kinduff.com/api/facts", json: true }, (error, response, body) => {
if (error) throw new Error(error);
message.channel.send(`**Did you know?**\n ${body.facts[0]}`);
message.channel.stopTyping();
});
} catch(err) {
message.channel.send(`<:error:466995152976871434> API error: ${err}`);
message.channel.stopTyping();
};
};
exports.conf = {

32
src/commands/yoda.js Normal file
View file

@ -0,0 +1,32 @@
const request = require('request')
exports.run = async (client, message, args) => {
const speech = args.join(' ');
if (!args[0]) {
return message.channel.send(`<:error:466995152976871434> Please include text for me to convert to yodish. Yes.`)
}
try {
const { text } = request({ uri: `http://yoda-api.appspot.com/api/v1/yodish?text=${encodeURIComponent(speech.toLowerCase())}`, json: true }, (error, response, body) => {
message.channel.send(JSON.parse(text).yodish)
});
} catch(err) {
message.channel.send(`<:error:466995152976871434> API error: ${err}`);
message.channel.stopTyping();
}
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ["yoda","yodasay"],
permLevel: "User",
requiredPerms: []
};
exports.help = {
name: "yodish",
category: "Fun",
description: "Turns any text you input into yodish. Yes.",
usage: "yodish <text>"
};