mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
update badge display, sync commands with slash commands
This commit is contained in:
parent
9eeb7f2721
commit
de8b946eed
4 changed files with 26 additions and 34 deletions
|
@ -56,6 +56,12 @@ module.exports = {
|
|||
if (u.discriminator && u.discriminator !== "0") usernameDisplay += `#${u.discriminator}`
|
||||
|
||||
usernameDisplay = `**@${usernameDisplay}**${botTag} ${highlight(`(${u.id})`)}`
|
||||
|
||||
// Badge Container
|
||||
let b = renderBadges(u)
|
||||
if(b.length >= 1) usernameDisplay += `\n${b.join('')}\n`
|
||||
|
||||
if(u.globalName !== null) usernameDisplay += `\n${smallIconPill("user_card", "Display Name")} ${smallPill(u.globalName)}`
|
||||
if (m && m.nick !== null) usernameDisplay += `\n${smallIconPill("user_card", "Nickname")} ${smallPill(m.nick)}`
|
||||
|
||||
let userCard = createEmbed("default", context, {
|
||||
|
@ -86,16 +92,6 @@ module.exports = {
|
|||
})
|
||||
}
|
||||
|
||||
// Badge Container
|
||||
let b = renderBadges(u)
|
||||
if (u.avatarUrl.endsWith('.gif') || u.banner) { b.push(BADGE_ICONS.nitro) }
|
||||
if (b.length >= 1) {
|
||||
userCard.fields.push({
|
||||
name: `${icon("nitro")} Badges`,
|
||||
value: b.join(''),
|
||||
inline: true
|
||||
})
|
||||
}
|
||||
return editOrReply(context, userCard)
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
|
|
|
@ -35,6 +35,12 @@ module.exports = {
|
|||
if (u.discriminator && u.discriminator !== "0") usernameDisplay += `#${u.discriminator}`
|
||||
|
||||
usernameDisplay = `**@${usernameDisplay}**${botTag} ${highlight(`(${u.id})`)}`
|
||||
|
||||
// Badge Container
|
||||
let b = renderBadges(u)
|
||||
if(b.length >= 1) usernameDisplay += `\n${b.join('')}\n`
|
||||
|
||||
if(u.globalName !== null) usernameDisplay += `\n${smallIconPill("user_card", "Display Name")} ${smallPill(u.globalName)}`
|
||||
if (m && m.nick !== null) usernameDisplay += `\n${smallIconPill("user_card", "Nickname")} ${smallPill(m.nick)}`
|
||||
|
||||
let userCard = createEmbed("default", context, {
|
||||
|
@ -65,16 +71,6 @@ module.exports = {
|
|||
})
|
||||
}
|
||||
|
||||
// Badge Container
|
||||
let b = renderBadges(u)
|
||||
if (u.avatarUrl.endsWith('.gif') || u.banner) { b.push(BADGE_ICONS.nitro) }
|
||||
if (b.length >= 1) {
|
||||
userCard.fields.push({
|
||||
name: `${icon("nitro")} Badges`,
|
||||
value: b.join(''),
|
||||
inline: true
|
||||
})
|
||||
}
|
||||
return editOrReply(context, userCard)
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
|
|
|
@ -47,6 +47,10 @@ module.exports = {
|
|||
|
||||
usernameDisplay = `**@${usernameDisplay}**${botTag} ${highlight(`(${u.id})`)}`
|
||||
|
||||
// Badge Container
|
||||
let b = renderBadges(u)
|
||||
if(b.length >= 1) usernameDisplay += `\n${b.join('')}\n`
|
||||
|
||||
if(u.globalName !== null) usernameDisplay += `\n${smallIconPill("user_card", "Display Name")} ${smallPill(u.globalName)}`
|
||||
if(m && m.nick !== null) usernameDisplay += `\n${smallIconPill("user_card", "Nickname")} ${smallPill(m.nick)}`
|
||||
|
||||
|
@ -78,18 +82,6 @@ module.exports = {
|
|||
})
|
||||
}
|
||||
|
||||
// Badge Container
|
||||
let b = renderBadges(u)
|
||||
if(u.avatarUrl.endsWith('.gif') || u.banner){ b.push(BADGE_ICONS.nitro)}
|
||||
if(b.length >= 1){
|
||||
userCard.fields.push({
|
||||
name: `${icon("nitro")} Badges`,
|
||||
value: b.join(''),
|
||||
inline: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if(!m?.banner && m) u.member = await context.guild.fetchMember(u.id)
|
||||
|
||||
// No special handling
|
||||
|
|
|
@ -40,8 +40,14 @@ const { Constants } = require('detritus-client');
|
|||
const { UserFlags } = Constants
|
||||
|
||||
const { BADGE_ICONS } = require('../constants');
|
||||
const { link } = require('./markdown');
|
||||
|
||||
const BADGE_TYPES = Object.freeze({
|
||||
"nitro": {
|
||||
description: "Discord Nitro",
|
||||
link: "https://discord.com/nitro",
|
||||
icon: BADGE_ICONS.nitro
|
||||
},
|
||||
"staff": {
|
||||
description: "Discord Staff",
|
||||
link: "https://discord.com/company",
|
||||
|
@ -121,7 +127,9 @@ const BADGES = Object.freeze({
|
|||
|
||||
function renderBadges(user){
|
||||
let badges = [];
|
||||
for(const flag of Object.keys(BADGES)) if(user.hasFlag(BADGES[flag])) badges.push(BADGE_TYPES[flag].icon)
|
||||
for(const flag of Object.keys(BADGES)) if(user.hasFlag(BADGES[flag])) badges.push(link(BADGE_TYPES[flag].link), BADGE_TYPES[flag].icon, BADGE_TYPES[flag].description)
|
||||
if(!user.bot && (user.avatarUrl.endsWith('.gif') || user.banner)) { badges.push(link(BADGE_TYPES["nitro"].link, BADGE_TYPES["nitro"].icon, BADGE_TYPES["nitro"].description)) }
|
||||
|
||||
return badges;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue