Added yodish.

This commit is contained in:
MrTech999 2020-03-11 20:47:06 +00:00
parent 76d6230e97
commit 5d8a81523f
11 changed files with 136 additions and 32 deletions

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.stopTyping();
message.channel.send(`**Did you know?**\n ${body.facts[0]}`);
});
} catch(err) {
message.channel.send(`<:error:466995152976871434> API error: ${err}`);
message.channel.stopTyping();
};
};
exports.conf = {

View file

@ -4,6 +4,7 @@ exports.run = (client, message, args, level) => {
var ran = false;
var output = "";
var commands = 0;
var prefix;
var currentCategory;
@ -14,7 +15,7 @@ exports.run = (client, message, args, level) => {
};
if(!args[0]) {
embed.setTitle("Command list");
embed.setTitle(`Commands [${client.commands.size}]`);
embed.setDescription(`For more information on a specific command use \`${prefix}help <command>\`\nFor the full command list use \`${prefix}help all\`\n`);
const myCommands = message.guild ? client.commands.filter(
@ -37,16 +38,18 @@ exports.run = (client, message, args, level) => {
const cat = c.help.category.toProperCase();
if (currentCategory !== cat) {
if(ran == true) {
embed.addField(currentCategory + ":", output.slice(0, -6))
embed.addField(currentCategory + ` [${commands}]`, output.slice(0, -2))
output = "";
commands = 0;
}
currentCategory = cat;
ran = true
}
output += `\`${prefix}${c.help.name}\`**,** `;
output += `\`${prefix}${c.help.name}\`, `;
commands = commands + 1;
});
embed.addField(currentCategory + ":", output.slice(0, -6));
embed.addField(currentCategory + ` [${commands}]`, output.slice(0, -2));
embed.addField(
"Invite me",
@ -65,7 +68,7 @@ exports.run = (client, message, args, level) => {
};
if(args[0].toLowerCase() == "all") {
embed.setTitle("Command list");
embed.setTitle(`Commands [${client.commands.size}]`);
embed.setDescription(`For more information on a specific command use \`${prefix}help <command>\`\nFor the full command list use \`${prefix}help all\`\n`);
const myCommands = client.commands
@ -84,16 +87,18 @@ exports.run = (client, message, args, level) => {
const cat = c.help.category.toProperCase();
if (currentCategory !== cat) {
if(ran == true) {
embed.addField(currentCategory + ":", output.slice(0, -6))
embed.addField(currentCategory + ` [${commands}]`, output.slice(0, -2))
output = "";
commands = 0;
}
currentCategory = cat;
ran = true
}
output += `\`${prefix}${c.help.name}\`**,** `;
output += `\`${prefix}${c.help.name}\`, `;
commands = commands + 1;
});
embed.addField(currentCategory + ":", output.slice(0, -6));
embed.addField(currentCategory + ` [${commands}]`, output.slice(0, -2));
embed.addField(
"Invite me",

View file

@ -20,7 +20,7 @@ exports.run = async (client, message) => {
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
aliases: ["inspire"],
permLevel: "User",
requiredPerms: []
};

37
src/commands/ship.js Normal file
View file

@ -0,0 +1,37 @@
const request = require('request')
exports.run = async (client, message, args) => {
message.channel.startTyping();
var user = client.getUserFromMention(args[0])
var user2 = client.getUserFromMention(args[1])
var secondLength = Math.floor(user2.username.length / 2);
var first = user.username.substr(0, user.username.length / 2)
var second = user2.username.substr(secondLength, user2.username.length / 2)
try {
var attachment = new Discord.MessageAttachment(`https://api.alexflipnote.dev/ship?user=${user.avatarURL({format: "png"})}&user2=${user2.avatarURL({format: "png"})}`)
message.channel.send(`Your ship name is **${first+second}!**`, attachment)
message.channel.stopTyping();
} catch(err) {
message.channel.send(`<:error:466995152976871434> API error: ${err}`);
message.channel.stopTyping();
};
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User",
requiredPerms: []
};
exports.help = {
name: "ship",
category: "Fun",
description: "Ship two people together <3",
usage: "ship name name2"
};

View file

@ -50,13 +50,6 @@ exports.run = (client, message, args) => {
if(badges.length > 0) {
badges += "\n"
}
createdTimestamp = user.user.createdTimestamp;
var date = new Date(createdTimestamp * 1000);
var hours = date.getHours();
var minutes = "0" + date.getMinutes();
var seconds = "o" + date.getSeconds();
console.log(date)
user.roles.cache.forEach((role) => {
roles = roles + role.name + "`, `"

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

@ -0,0 +1,31 @@
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>"
};

View file

@ -133,6 +133,22 @@ module.exports = client => {
return a;
};
// USER OBJECT FROM MENTION
client.getUserFromMention = mention => {
if (!mention) return;
if (mention.startsWith('<@') && mention.endsWith('>')) {
mention = mention.slice(2, -1);
if (mention.startsWith('!')) {
mention = mention.slice(1);
}
return client.users.cache.get(mention);
}
}
// MUSIC
client.music = {guilds: {}};