mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
h
This commit is contained in:
parent
726861294b
commit
aec828beb5
14 changed files with 421 additions and 25 deletions
80
commands/message/info/user.js
Normal file
80
commands/message/info/user.js
Normal file
|
@ -0,0 +1,80 @@
|
|||
const { createEmbed } = require("../../../labscore/utils/embed");
|
||||
const { icon, highlight, timestamp } = require("../../../labscore/utils/markdown");
|
||||
const { editOrReply } = require("../../../labscore/utils/message");
|
||||
const { getUser, renderBadges } = require("../../../labscore/utils/users");
|
||||
|
||||
const { Constants } = require('detritus-client')
|
||||
const { UserFlags } = Constants
|
||||
|
||||
module.exports = {
|
||||
name: 'user',
|
||||
label: 'user',
|
||||
aliases: ['u'],
|
||||
metadata: {
|
||||
description: 'user',
|
||||
examples: ['user labsCore'],
|
||||
category: 'info',
|
||||
usage: 'user [<id|user>]'
|
||||
},
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
try{
|
||||
let u;
|
||||
if(!args.user) { args.user = context.user.id }
|
||||
user = await getUser(context, args.user)
|
||||
u = user.user
|
||||
if(!u) return editOrReply(context, { embeds: [createEmbed("warning", context, "No users found.")] })
|
||||
let m = user.member
|
||||
|
||||
// User Card
|
||||
|
||||
// TODO: create bot tag emoji for this
|
||||
let botTag = ''
|
||||
if(u.bot) botTag = ""
|
||||
if(u.hasFlag(UserFlags.VERIFIED_BOT)) botTag = ""
|
||||
|
||||
let userCard = createEmbed("default", context, {
|
||||
description: `${icon("person")} **${u.name}#${u.discriminator}**${botTag} ${highlight(`(${u.id})`)}`,
|
||||
thumbnail: {
|
||||
url: u.avatarUrl + `?size=4096`
|
||||
},
|
||||
fields: [{
|
||||
name: `${icon("calendar")} Dates`,
|
||||
value: `**Account Created: **${timestamp(u.createdAt)}`,
|
||||
inline: false
|
||||
}]
|
||||
})
|
||||
if(u.banner) userCard.image = { url: u.bannerUrl + `?size=4096`}
|
||||
|
||||
// Guild Container
|
||||
if(m){
|
||||
userCard.fields[0].value = userCard.fields[0].value + `\n**Joined Guild: **${timestamp(m.joinedAt)}`
|
||||
let guildFields = []
|
||||
|
||||
// TODO: make this an icon()
|
||||
if(m.isOwner) guildFields.push(`**Server Owner** <:lc_guild_owner:674652779406426122>`)
|
||||
if(m.roles.length >= 1) guildFields.push(`**Roles: ** ${m.roles.length}/${context.guild.roles.length}`)
|
||||
if(m.premiumSince) guildFields.push(`**Boosting since: ** ${m.premiumSince.toLocaleString('en-US')}`) // TODO: make this a timestamp
|
||||
userCard.fields.push({
|
||||
name: `${icon("house")} Server`,
|
||||
value: guildFields.join('\n'),
|
||||
inline: true
|
||||
})
|
||||
}
|
||||
|
||||
// Badge Container
|
||||
let b = renderBadges(u)
|
||||
if(u.avatarUrl.endsWith('.gif') || u.banner){ b.push('<:badge_nitro:917012997463998485>' )}
|
||||
if(b.length >= 1){
|
||||
userCard.fields.push({
|
||||
name: `${icon("nitro")} Badges`,
|
||||
value: b.join(''),
|
||||
inline: true
|
||||
})
|
||||
}
|
||||
return editOrReply(context, { embeds: [userCard] })
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue