Process of format fixing
This commit is contained in:
@@ -4,7 +4,7 @@ import { ChatInputCommandInteraction } from "discord.js"
|
||||
import { GuildData } from "interfaces"
|
||||
|
||||
export default async function guildInfo(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
interaction: ChatInputCommandInteraction
|
||||
): Promise<void> {
|
||||
await interaction.deferReply()
|
||||
|
||||
@@ -18,9 +18,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const uuid = await getUUID(query)
|
||||
@@ -29,9 +29,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "That player doen't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -40,9 +40,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your player data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const player = await getPlayer(uuid)
|
||||
@@ -51,9 +51,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "That player has never joined the server!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -62,9 +62,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
guild = await getGuild(uuid, "player")
|
||||
@@ -73,9 +73,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "That player is not in a guild!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -84,9 +84,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "name")
|
||||
@@ -95,9 +95,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -106,9 +106,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "id")
|
||||
@@ -117,9 +117,9 @@ export default async function guildInfo(
|
||||
embeds: [
|
||||
{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -157,14 +157,14 @@ export default async function guildInfo(
|
||||
const guildOwner = guildMembers.find(m => m.rank === "Guild Master")!.uuid
|
||||
const guildOwnerName = await getIGN(guildOwner)
|
||||
const guildRanksUnsorted = guild!.ranks.sort(
|
||||
(a, b) => b.priority - a.priority,
|
||||
(a, b) => b.priority - a.priority
|
||||
)
|
||||
const guildRanks = guildRanksUnsorted
|
||||
.map(r => "**➺ " + r.name + "** `[" + r.tag + "]`")
|
||||
.join("\n")
|
||||
|
||||
const allGuildMembersWeeklyXP = guildMembers.map(
|
||||
member => member.expHistory,
|
||||
member => member.expHistory
|
||||
)
|
||||
const guildMembersWeeklyXP = allGuildMembersWeeklyXP.map(member => {
|
||||
return Object.values(member).reduce((a, b) => a + b, 0)
|
||||
@@ -172,17 +172,17 @@ export default async function guildInfo(
|
||||
|
||||
const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce(
|
||||
(a, b) => a + b,
|
||||
0,
|
||||
0
|
||||
)
|
||||
const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(
|
||||
totalGuildMembersWeeklyXPUnformatted,
|
||||
totalGuildMembersWeeklyXPUnformatted
|
||||
)
|
||||
|
||||
const averageGuildMembersWeeklyXPUnformatted = Math.round(
|
||||
totalGuildMembersWeeklyXPUnformatted / 7,
|
||||
totalGuildMembersWeeklyXPUnformatted / 7
|
||||
)
|
||||
const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(
|
||||
averageGuildMembersWeeklyXPUnformatted,
|
||||
averageGuildMembersWeeklyXPUnformatted
|
||||
)
|
||||
|
||||
await interaction.editReply({
|
||||
@@ -205,7 +205,7 @@ export default async function guildInfo(
|
||||
fields: [
|
||||
{
|
||||
name: "**Guild Ranks**",
|
||||
value: guildRanks,
|
||||
value: guildRanks
|
||||
},
|
||||
{
|
||||
name: "**GEXP**",
|
||||
@@ -218,19 +218,19 @@ export default async function guildInfo(
|
||||
"`\n" +
|
||||
"**➺ Total GEXP:** `" +
|
||||
guildExp +
|
||||
"`",
|
||||
"`"
|
||||
},
|
||||
{
|
||||
name: "**Guild Created**",
|
||||
value: "**➺ **`" + guildCreatedTime + "`",
|
||||
},
|
||||
value: "**➺ **`" + guildCreatedTime + "`"
|
||||
}
|
||||
],
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { color, devMessage } from "config/options.json"
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
|
||||
export default async function guildMember(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
interaction: ChatInputCommandInteraction
|
||||
): Promise<void> {
|
||||
await interaction.deferReply()
|
||||
|
||||
@@ -14,9 +14,9 @@ export default async function guildMember(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const uuid = await getUUID(ign)
|
||||
@@ -25,9 +25,9 @@ export default async function guildMember(
|
||||
embeds: [
|
||||
{
|
||||
description: "This user does not exist",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -36,9 +36,9 @@ export default async function guildMember(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your player data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const head = await getHeadURL(ign)
|
||||
@@ -50,14 +50,14 @@ export default async function guildMember(
|
||||
description: "This user never logged on to hypixel",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -83,9 +83,9 @@ export default async function guildMember(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
@@ -96,14 +96,14 @@ export default async function guildMember(
|
||||
description: "This user is not in a guild",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -129,16 +129,16 @@ export default async function guildMember(
|
||||
const expValue = allDaysGexp.join("")
|
||||
const totalWeeklyGexpUnformatted = Object.values(memberGexp).reduce(
|
||||
(a, b) => a + b,
|
||||
0,
|
||||
0
|
||||
)
|
||||
const totalWeeklyGexp = new Intl.NumberFormat("en-US").format(
|
||||
totalWeeklyGexpUnformatted,
|
||||
totalWeeklyGexpUnformatted
|
||||
)
|
||||
const averageWeeklyGexpUnformatted = Math.round(
|
||||
totalWeeklyGexpUnformatted / 7,
|
||||
totalWeeklyGexpUnformatted / 7
|
||||
)
|
||||
const averageWeeklyGexp = new Intl.NumberFormat("en-US").format(
|
||||
averageWeeklyGexpUnformatted,
|
||||
averageWeeklyGexpUnformatted
|
||||
)
|
||||
|
||||
const guildMemberJoinMS = guildMember!.joined
|
||||
@@ -176,12 +176,12 @@ export default async function guildMember(
|
||||
"`\n",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
url: head!
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: "**Daily GEXP**",
|
||||
value: expValue,
|
||||
value: expValue
|
||||
},
|
||||
{
|
||||
name: "**Weekly GEXP**",
|
||||
@@ -191,18 +191,18 @@ export default async function guildMember(
|
||||
"`\n" +
|
||||
"**➺ Daily avarage:** `" +
|
||||
averageWeeklyGexp +
|
||||
"`",
|
||||
"`"
|
||||
},
|
||||
{
|
||||
name: "**Join date**",
|
||||
value: "**➺ **`" + guildMemberJoin + "`",
|
||||
},
|
||||
value: "**➺ **`" + guildMemberJoin + "`"
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import Illegitimate from "utils/Illegitimate"
|
||||
const redis = Illegitimate.redis
|
||||
|
||||
export default async function guildTop(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
interaction: ChatInputCommandInteraction
|
||||
): Promise<void> {
|
||||
await interaction.deferReply()
|
||||
|
||||
@@ -21,9 +21,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "You can't use this command in DMs!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -33,9 +33,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const uuid = await getUUID(query)
|
||||
@@ -44,9 +44,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "That player doen't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -55,9 +55,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your player data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const player = await getPlayer(uuid)
|
||||
@@ -66,9 +66,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "That player has never joined the server!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -77,9 +77,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
guild = await getGuild(uuid, "player")
|
||||
@@ -88,9 +88,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "That player is not in a guild!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -99,9 +99,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "name")
|
||||
@@ -110,9 +110,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -121,9 +121,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "id")
|
||||
@@ -132,9 +132,9 @@ export default async function guildTop(
|
||||
embeds: [
|
||||
{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -152,20 +152,20 @@ export default async function guildTop(
|
||||
})
|
||||
.reduce((a, b) => a + b, 0)
|
||||
const gexpToday = new Intl.NumberFormat("en-US").format(
|
||||
gexpTodayUnformatted,
|
||||
gexpTodayUnformatted
|
||||
)
|
||||
|
||||
const averageGuildMemberGEXPUnformatted = Math.floor(
|
||||
gexpTodayUnformatted / guildMembers.length,
|
||||
gexpTodayUnformatted / guildMembers.length
|
||||
)
|
||||
const averageGuildMemberGEXP = new Intl.NumberFormat("en-US").format(
|
||||
averageGuildMemberGEXPUnformatted,
|
||||
averageGuildMemberGEXPUnformatted
|
||||
)
|
||||
|
||||
const allMembersDailyGEXP = guildMembers.map(member => {
|
||||
return {
|
||||
uuid: member.uuid,
|
||||
gexp: member.expHistory[Object.keys(member.expHistory)[0]],
|
||||
gexp: member.expHistory[Object.keys(member.expHistory)[0]]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -199,9 +199,9 @@ export default async function guildTop(
|
||||
" members of " +
|
||||
guildName +
|
||||
"...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
for (let i = 0; i < allMembersSortedUUIDArray.length; i++) {
|
||||
@@ -210,7 +210,7 @@ export default async function guildTop(
|
||||
|
||||
guildData.push({
|
||||
ign: ign!,
|
||||
uuid: uuid,
|
||||
uuid: uuid
|
||||
})
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ export default async function guildTop(
|
||||
"guildTop+" + guildId,
|
||||
JSON.stringify(guildData),
|
||||
"EX",
|
||||
60 * 30,
|
||||
60 * 30
|
||||
)
|
||||
} else {
|
||||
cacheStatus = true
|
||||
@@ -231,9 +231,9 @@ export default async function guildTop(
|
||||
" members of " +
|
||||
guildName +
|
||||
"using cache...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
})
|
||||
guildData = JSON.parse(cachedData)
|
||||
}
|
||||
@@ -244,7 +244,7 @@ export default async function guildTop(
|
||||
for (let i = 0; i < amount; i++) {
|
||||
const gexp = new Intl.NumberFormat("en-US").format(topMembers[i].gexp)
|
||||
const ign = guildData.find(
|
||||
member => member.uuid === topMembers[i].uuid,
|
||||
member => member.uuid === topMembers[i].uuid
|
||||
)?.ign
|
||||
|
||||
const position = i + 1
|
||||
@@ -253,7 +253,7 @@ export default async function guildTop(
|
||||
}
|
||||
|
||||
const list = Array.from({ length: sliceSize }, (_, i) =>
|
||||
fieldsValueRaw.slice(i * sliceSize, (i + 1) * sliceSize),
|
||||
fieldsValueRaw.slice(i * sliceSize, (i + 1) * sliceSize)
|
||||
)
|
||||
const newList: NewList = []
|
||||
|
||||
@@ -263,7 +263,7 @@ export default async function guildTop(
|
||||
newList[index] = {
|
||||
name: "",
|
||||
value: item.join("\n"),
|
||||
inline: false,
|
||||
inline: false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -288,9 +288,9 @@ export default async function guildTop(
|
||||
" | " +
|
||||
devMessage +
|
||||
cacheStatusText,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user