Synced changes

This commit is contained in:
Emily 2020-03-11 21:46:13 +11:00
parent 42f3fd10ff
commit a82d6cff82
4 changed files with 58 additions and 2 deletions

View file

@ -4,3 +4,6 @@ Added dogfact and catfact command (terry)
index.js now has better logging of when things fail to load/initialize (terry) index.js now has better logging of when things fail to load/initialize (terry)
added `dice`, rolls a 6 sided die (terry) added `dice`, rolls a 6 sided die (terry)
Help command changed, the amount of commands in each category and overall is now displayed Help command changed, the amount of commands in each category and overall is now displayed
added `inspire` as an alias for inspirobot
ship command
added find by mention to functions

View file

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

@ -133,6 +133,22 @@ module.exports = client => {
return a; 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 // MUSIC
client.music = {guilds: {}}; client.music = {guilds: {}};