Merge remote-tracking branch 'origin/master'

This commit is contained in:
rhearmas 2020-01-10 20:25:55 -05:00
commit 4b4fd90599
2 changed files with 74 additions and 57 deletions

View file

@ -48,13 +48,13 @@ async function getUUID(username) {
exports.conf = { exports.conf = {
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: ["mcinfo","minecraftuser"], aliases: ["minecraftuser"],
permLevel: "User" permLevel: "User"
}; };
exports.help = { exports.help = {
name: "playerinfo", name: "mcinfo",
category: "Information", category: "Information",
description: "Shows information about a Minecraft player.", description: "Shows information about a Minecraft player.",
usage: "playerinfo <username>" usage: "mcinfo <username>"
}; };

View file

@ -1,22 +1,16 @@
const dateFormat = require('dateformat'); function titleCase(str) {
str = str.toLowerCase().split(' ');
dateFormat('dddd, mmmm dS, yyyy, h:MM:ss TT'); for (let i = 0; i < str.length; i++) {
str[i] = str[i].charAt(0).toUpperCase() + str[i].slice(1);
}
return str.join(' ');
}
exports.run = async (client, message, args, level) => { exports.run = async (client, message, args, level) => {
if (!message.guild) { let user = message.mentions.users.first() || message.author;
message.delete();
return (await message.reply("this can only be used in a guild!")).delete(5000);
}
if (message.mentions.users.size < 1) {
message.delete();
return (await message.reply("@mention someone to find their info.")).delete(5000);
}
let user = message.mentions.users.first();
let member = message.guild.member(user); let member = message.guild.member(user);
if (!member) { if (!member) {
message.delete(); message.delete();
return (await message.reply("that member could not be found!")).delete(5000); return (await message.reply("that member could not be found!")).delete(5000);
} }
@ -26,65 +20,88 @@ exports.run = async (client, message, args, level) => {
const millisJoined = new Date().getTime() - member.joinedAt.getTime(); const millisJoined = new Date().getTime() - member.joinedAt.getTime();
const daysJoined = millisJoined / 1000 / 60 / 60 / 24; const daysJoined = millisJoined / 1000 / 60 / 60 / 24;
let roles = member.roles.array().slice(1).sort((a, b) => a.comparePositionTo(b)).reverse().map(role => role.name); let roles = member.roles.array().slice(1).sort((a, b) => a.comparePositionTo(b)).reverse().map(role => role.name);
if (roles.length < 1) roles = ['None']; if (roles.length < 1) roles = ['None'];
let embed = client.embed( let game = (user.presence.game && user.presence.game && user.presence.game.name) || 'Not playing a game.'
`${user.username}#${message.mentions.users.first().discriminator}`,
'***This message will dissappear in 60 seconds.***', await message.delete();
message.channel.send({ embed: client.embed(
`User info: ${target.user.tag}`,
"**This message will be deleted in 60 seconds. :bomb:",
[ [
{ {
name: 'Status', name: "= Status =",
value: `${user.presence.status[0].toUpperCase() + user.presence.status.slice(1)}`, value: `${user.presence.status[0].toUpperCase() + user.presence.status.slice(1)}`
}, },
{ {
name: 'Game', name: "= Game =",
value: `${(user.presence.game && user.presence.game && user.presence.game.name) || 'Not playing a game.'}`, value: `${(user.presence.game && user.presence.game && user.presence.game.name) || 'Not playing a game.'}`
}, },
{ {
name: 'Created On', name: "= Nickname =",
value: `${dateFormat(user.createdAt)}`, value: target.guildMember.nickname,
inline: true
}, },
{ {
name: 'Days Since Creation', name: "= Unique User ID (UUID) =",
value: `${daysCreated.toFixed(0)}`, value: target.user.id,
inline: true
}, },
{ {
name: 'Joined On', name: "= Shared Servers =",
value: `${dateFormat(member.joinedAt)}`, value: target.userProfile.mutualGuilds,
inline: true
}, },
{ {
name: 'Days Since Joining', name: "= Account Creation Date =",
value: `${daysJoined.toFixed(0)}`, value: dateFormat(user.createdAt),
inline: true
}, },
{ {
name: 'Roles', name: "= Days Since Creation =",
value: `\`${roles.join('`, `')}\``, value: daysCreated.toFixed(0),
inline: false, inline: true
}
{
name: "= Server Join Date =",
value: target.guildMember.joinedAt,
inline: true
}, },
{
name: "= Days Since Joining =",
value: daysJoined.toFixed(0),
inline: true
},
{
name: "= Last Spoken =",
value: `**${target.guildMember.lastMessage.createdAt}**, at server **${target.guildMember.lastMessage.guild}**`,
inline: true
},
{
name: "= User Roles =",
value: roles,
inline: true
}
], ],
{ {
inline: true, inline: true,
footer: `User ID: ${user.id}`, footer: `Sent by ${message.author}`
thumbnail: user.displayAvatarURL footerIcon: message.author.avatarURL
} });
);
message.delete();
(await message.channel.send({ embed })).delete(60000);
}; };
exports.conf = { exports.conf = {
enabled: true, enabled: true,
guildOnly: false, guildOnly: true,
aliases: [], aliases: ["user","uinfo"],
permLevel: "User" permLevel: "User"
}; };
exports.help = { exports.help = {
name: "userinfo", name: "userinfo",
category: "Information", category: "Information",
description: "Provides some information about a mentioned user.", description: "Gather information about a user, and returns the gathered stuff into an embed.",
usage: "userinfo <@mention>" usage: "userinfo [ping:self]"
}; };