userinfo command

This commit is contained in:
Emily 2021-03-04 12:29:21 +11:00
parent 936dd91407
commit 10a1e24c18

View file

@ -24,11 +24,11 @@ module.exports = class {
if (args[0]) { if (args[0]) {
if (message.mentions.length > 0) { if (message.mentions.length > 0) {
member = await message.channel.guild.searchMembers(message.mentions[0]); member = await client.functions.getMember(message.channel.guild, message.mentions[0].id);
} else { } else {
member = await message.channel.guild.searchMembers(args.join(' '), 2); member = await message.channel.guild.searchMembers(args.join(' '), 2);
if (member.length < 1) return message.channel.createMessage( if (member.length === 0) return message.channel.createMessage(
`${client.emojis.userError} No users found. Check for mispellings, or ping the user instead.` `${client.emojis.userError} No users found. Check for mispellings, or ping the user instead.`
); );
@ -40,14 +40,34 @@ module.exports = class {
} }
} }
const badges = [];
if (client.config.ownerIDs.includes(member.id)) badges.push('<:Woomy_Developer:816822318289518622> ');
if (member.id === member.guild.ownerID) badges.push('<:owner:685703193694306331>');
if (member.bot) badges.push('<:bot:686489601678114859>');
const roles = [];
for (const roleID of member.roles) {
if (roles.length === 45) {
roles.push(`and ${member.roles.length - 45} more`);
break;
}
roles.push(`<@&${roleID}>`);
}
const embed = new client.RichEmbed() const embed = new client.RichEmbed()
.setTitle(member.user.username + '#' + member.user.discriminator) .setTitle(member.user.username + '#' + member.user.discriminator)
.setColour(client.functions.displayHexColour(message.channel.guild, member.id)) .setColour(client.functions.displayHexColour(message.channel.guild, member))
.setThumbnail(member.user.avatarURL || member.user.defaultAvatarURL) .setThumbnail(member.user.avatarURL || member.user.defaultAvatarURL)
.addField('Display Name', member.nick || member.user.username, true) .addField('Display Name', member.nick || member.user.username, true)
.addField('User ID', member.id, true) .addField('User ID', member.id, true)
.addField('Joined Server', `${dayjs(member.joinedAt).format('D/M/YYYY HH:mm (UTCZ)')}\n*${dayjs().to(member.joinedAt)}*`) .addField('Highest Role', `<@&${client.functions.highestRole(member).id}>`, true)
.addField('Roles:', roles.join(' '))
.addField('Joined Server', `${dayjs(member.joinedAt).format('D/M/YYYY HH:mm (UTCZ)')}\n*${dayjs().to(member.joinedAt)}*`, true)
.addField('Joined Discord', `${dayjs(member.user.createdAt).format('D/M/YYYY HH:mm (UTCZ)')}\n*${dayjs().to(member.user.createdAt)}*`, true); .addField('Joined Discord', `${dayjs(member.user.createdAt).format('D/M/YYYY HH:mm (UTCZ)')}\n*${dayjs().to(member.user.createdAt)}*`, true);
if (badges.length > 0) embed.setDescription(badges.join(' '));
message.channel.createMessage({ embed: embed }); message.channel.createMessage({ embed: embed });
} }