Haha-Yes/commands/utility/userInfo.js

77 lines
2.7 KiB
JavaScript
Raw Permalink Normal View History

2019-11-15 21:48:03 +01:00
const { Command } = require('discord-akairo');
class userInfoCommand extends Command {
constructor() {
super('userInfo', {
aliases: ['userInfo', 'user'],
category: 'utility',
clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'],
2020-03-19 23:24:31 +01:00
channel: 'guild',
2019-11-15 21:48:03 +01:00
args: [
{
id: 'user',
type: 'user',
},
],
description: {
content: 'Show info about a user',
2019-11-15 21:49:34 +01:00
usage: '[@user]',
examples: ['@SomeoneReallyCoolInMyGuild']
2019-11-15 21:48:03 +01:00
}
});
}
async exec(message, args) {
let user = message.author;
if (args.user) {
user = args.user;
}
let member = await message.guild.members.fetch(user);
2019-11-22 12:30:20 +01:00
const Embed = this.client.util.embed()
2020-04-15 04:45:05 +02:00
.setColor(member ? member.displayHexColor : 'NAVY')
2019-11-15 21:48:03 +01:00
.setAuthor(`${user.tag} (${user.id})`, user.displayAvatarURL())
2020-04-15 04:47:50 +02:00
.addField('Current rank hex color', member ? member.displayHexColor : 'No rank color', true)
2020-04-15 04:48:41 +02:00
.addField('Joined guild at', member ? member.joinedAt : 'Not in this guild', true)
2019-11-15 21:48:03 +01:00
.addField('Date when account created', user.createdAt, true)
.setTimestamp();
2020-03-04 12:29:32 +01:00
Embed.addField('', '');
2019-11-15 22:13:33 +01:00
// Show user status
2020-03-07 18:03:54 +01:00
if (user.presence.activities[0]) {
Embed.addField('Presence', user.presence.activities[0], true);
if (user.presence.activities[0].details) Embed.addField('', user.presence.activities[0].details, true);
if (user.presence.activities[0].state) Embed.addField('', user.presence.activities[0].state, true);
}
// Is the user a bot?
if (user.bot) Embed.addField('Is a bot?', '✅', true);
2019-11-15 21:48:03 +01:00
// Show user locale ( i have no idea what it is ) https://discord.js.org/#/docs/main/master/class/User?scrollTo=locale
if (user.locale) Embed.addField('Locale settings', user.locale, true);
2019-11-15 22:13:33 +01:00
// Show on which platform they are using discord from if its not a bot
if (user.presence.clientStatus && !user.bot) {
2020-03-04 12:29:32 +01:00
Embed.addField('', '');
2019-11-15 23:26:16 +01:00
if (user.presence.clientStatus.mobile) Embed.addField('Using discord on', '📱 ' + user.presence.clientStatus.mobile, true);
if (user.presence.clientStatus.desktop) Embed.addField('Using discord on', '💻 ' + user.presence.clientStatus.desktop, true);
if (user.presence.clientStatus.web) Embed.addField('Using discord on', '☁️ ' + user.presence.clientStatus.web, true);
2019-11-15 22:13:33 +01:00
}
if (member) {
// Show since when this user have been boosting the current guild
if (member.premiumSince) Embed.addField('Boosting this guild since', member.premiumSince, true);
// Show guild nickname
if (member.nickname) Embed.addField('Nickname', member.nickname, true);
// Show member roles
if (member.roles) Embed.addField('Roles', `${member.roles.cache.array().join(', ')}`);
}
return message.reply({ embed: Embed });
2019-11-15 21:48:03 +01:00
}
}
module.exports = userInfoCommand;