Replaced clang format with prettuier (sadly)
This commit is contained in:
@@ -2,17 +2,21 @@ import { getUUID, getPlayer, getGuild, getHeadURL } from "../../utils/Hypixel"
|
||||
import { color, devMessage } from "../../../config/options.json"
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
|
||||
async function guildMember(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
async function guildMember(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
await interaction.deferReply()
|
||||
|
||||
const ign = interaction.options.getString("ign")!
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor
|
||||
}]
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const uuid = await getUUID(ign)
|
||||
@@ -29,10 +33,12 @@ async function guildMember(interaction: ChatInputCommandInteraction): Promise<vo
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your player data...",
|
||||
color: embedColor
|
||||
}]
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your player data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const head = await getHeadURL(ign)
|
||||
@@ -48,7 +54,9 @@ async function guildMember(interaction: ChatInputCommandInteraction): Promise<vo
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL({ forceStatic: false })!
|
||||
icon_url: interaction.guild!.iconURL({
|
||||
forceStatic: false,
|
||||
})!,
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -74,26 +82,32 @@ async function guildMember(interaction: ChatInputCommandInteraction): Promise<vo
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
if (!guild) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "This user is not in a guild",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
embeds: [
|
||||
{
|
||||
description: "This user is not in a guild",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL({
|
||||
forceStatic: false,
|
||||
})!,
|
||||
},
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL({ forceStatic: false })!,
|
||||
},
|
||||
}],
|
||||
],
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -102,17 +116,34 @@ async function guildMember(interaction: ChatInputCommandInteraction): Promise<vo
|
||||
const guildTag = " [" + guild.tag + "]" ?? ""
|
||||
|
||||
const guildMembers = guild.members
|
||||
const guildMember = guildMembers.find((member) => member.uuid === uuid)
|
||||
const guildMember = guildMembers.find(member => member.uuid === uuid)
|
||||
const guildRank = guildMember!.rank
|
||||
const memberGexp = guildMember!.expHistory
|
||||
const allDaysGexp = Object.keys(memberGexp).map((key) => {
|
||||
return "**➺ " + key + ":** " + "`" + new Intl.NumberFormat("en-US").format(memberGexp[key]) + "`" + "\n"
|
||||
const allDaysGexp = Object.keys(memberGexp).map(key => {
|
||||
return (
|
||||
"**➺ " +
|
||||
key +
|
||||
":** " +
|
||||
"`" +
|
||||
new Intl.NumberFormat("en-US").format(memberGexp[key]) +
|
||||
"`" +
|
||||
"\n"
|
||||
)
|
||||
})
|
||||
const expValue = allDaysGexp.join("")
|
||||
const totalWeeklyGexpUnformatted = Object.values(memberGexp).reduce((a, b) => a + b, 0)
|
||||
const totalWeeklyGexp = new Intl.NumberFormat("en-US").format(totalWeeklyGexpUnformatted)
|
||||
const averageWeeklyGexpUnformatted = Math.round(totalWeeklyGexpUnformatted / 7)
|
||||
const averageWeeklyGexp = new Intl.NumberFormat("en-US").format(averageWeeklyGexpUnformatted)
|
||||
const totalWeeklyGexpUnformatted = Object.values(memberGexp).reduce(
|
||||
(a, b) => a + b,
|
||||
0,
|
||||
)
|
||||
const totalWeeklyGexp = new Intl.NumberFormat("en-US").format(
|
||||
totalWeeklyGexpUnformatted,
|
||||
)
|
||||
const averageWeeklyGexpUnformatted = Math.round(
|
||||
totalWeeklyGexpUnformatted / 7,
|
||||
)
|
||||
const averageWeeklyGexp = new Intl.NumberFormat("en-US").format(
|
||||
averageWeeklyGexpUnformatted,
|
||||
)
|
||||
|
||||
const guildMemberJoinMS = guildMember!.joined
|
||||
const guildMemberJoinTime = new Date(guildMemberJoinMS)
|
||||
@@ -124,46 +155,67 @@ async function guildMember(interaction: ChatInputCommandInteraction): Promise<vo
|
||||
const guildMemberJoinSeconds = guildMemberJoinTime.getSeconds()
|
||||
|
||||
const guildMemberJoin =
|
||||
guildMemberJoinDate + "." +
|
||||
guildMemberJoinMonth + "." +
|
||||
guildMemberJoinYear + " " +
|
||||
guildMemberJoinHours + ":" +
|
||||
guildMemberJoinMinutes + ":" +
|
||||
guildMemberJoinDate +
|
||||
"." +
|
||||
guildMemberJoinMonth +
|
||||
"." +
|
||||
guildMemberJoinYear +
|
||||
" " +
|
||||
guildMemberJoinHours +
|
||||
":" +
|
||||
guildMemberJoinMinutes +
|
||||
":" +
|
||||
guildMemberJoinSeconds
|
||||
|
||||
const footerText = interaction.guild ? interaction.guild.name : interaction.user.username
|
||||
const footerIcon = interaction.guild ? interaction.guild.iconURL({ forceStatic: false }) : interaction.user.avatarURL({ forceStatic: false })
|
||||
const footerText = interaction.guild
|
||||
? interaction.guild.name
|
||||
: interaction.user.username
|
||||
const footerIcon = interaction.guild
|
||||
? interaction.guild.iconURL({ forceStatic: false })
|
||||
: interaction.user.avatarURL({ forceStatic: false })
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: rank + displayName + guildTag,
|
||||
description: "**Guild Name:** `" + guildName + "`\n" +
|
||||
"**Guild Rank:** `" + guildRank + "`\n",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
embeds: [
|
||||
{
|
||||
title: rank + displayName + guildTag,
|
||||
description:
|
||||
"**Guild Name:** `" +
|
||||
guildName +
|
||||
"`\n" +
|
||||
"**Guild Rank:** `" +
|
||||
guildRank +
|
||||
"`\n",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: "**Daily GEXP**",
|
||||
value: expValue,
|
||||
},
|
||||
{
|
||||
name: "**Weekly GEXP**",
|
||||
value:
|
||||
"**➺ Total:** `" +
|
||||
totalWeeklyGexp +
|
||||
"`\n" +
|
||||
"**➺ Daily avarage:** `" +
|
||||
averageWeeklyGexp +
|
||||
"`",
|
||||
},
|
||||
{
|
||||
name: "**Join date**",
|
||||
value: "**➺ **`" + guildMemberJoin + "`",
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: footerText + " | " + devMessage,
|
||||
icon_url: footerIcon!,
|
||||
},
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: "**Daily GEXP**",
|
||||
value: expValue,
|
||||
},
|
||||
{
|
||||
name: "**Weekly GEXP**",
|
||||
value: "**➺ Total:** `" + totalWeeklyGexp + "`\n" +
|
||||
"**➺ Daily avarage:** `" + averageWeeklyGexp + "`",
|
||||
},
|
||||
{
|
||||
name: "**Join date**",
|
||||
value: "**➺ **`" + guildMemberJoin + "`",
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: footerText + " | " + devMessage,
|
||||
icon_url: footerIcon!
|
||||
},
|
||||
}],
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
export = guildMember
|
||||
export = guildMember
|
||||
|
||||
Reference in New Issue
Block a user