Process of format fixing

This commit is contained in:
2024-01-19 21:36:01 +01:00
parent ee217d5f64
commit 3eed20e788
77 changed files with 1079 additions and 1086 deletions

View File

@@ -2,7 +2,7 @@ import {
hypixelGuildID,
guildLogChannel,
color,
devMessage,
devMessage
} from "config/options.json"
import colorLog from "utils/functions/colors"
import { getGuild, getIGN } from "utils/Hypixel"
@@ -25,9 +25,9 @@ async function guildWeekly() {
embeds: [
{
description: "Starting to fetch guild data...",
color: embedColor,
},
],
color: embedColor
}
]
})
const guild = (await getGuild(hypixelGuildID, "id")) as GuildData
@@ -45,10 +45,7 @@ async function guildWeekly() {
.map(member => {
return {
uuid: member.uuid,
exp: Object.values(member.expHistory).reduce(
(a, b) => a + b,
0,
),
exp: Object.values(member.expHistory).reduce((a, b) => a + b, 0)
}
})
.sort((a, b) => b.exp - a.exp)
@@ -56,16 +53,16 @@ async function guildWeekly() {
for (let i = 0; i < allMembersGexpSorted.length; i++) {
const ign = await getIGN(allMembersGexpSorted[i].uuid)
const gexp = new Intl.NumberFormat("en-US").format(
allMembersGexpSorted[i].exp,
allMembersGexpSorted[i].exp
)
const position = i + 1
guildMembersList.push(
"**#" + position + " " + ign + ":** `" + gexp + "`",
"**#" + position + " " + ign + ":** `" + gexp + "`"
)
}
const list = Array.from({ length: sliceSize }, (_, i) =>
guildMembersList.slice(i * sliceSize, (i + 1) * sliceSize),
guildMembersList.slice(i * sliceSize, (i + 1) * sliceSize)
)
list.forEach((item, index) => {
@@ -74,30 +71,30 @@ async function guildWeekly() {
topWeeklyMembers[index] = {
name: "",
value: item.join("\n"),
inline: false,
inline: false
}
})
// combined weekly gexp
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)
})
const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce(
(a, b) => a + b,
0,
0
)
const averageGuildMembersDailyXPUnformatted =
totalGuildMembersWeeklyXPUnformatted / 7
// final values
const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(
totalGuildMembersWeeklyXPUnformatted,
totalGuildMembersWeeklyXPUnformatted
)
const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(
averageGuildMembersDailyXPUnformatted,
averageGuildMembersDailyXPUnformatted
)
await message.edit({
@@ -115,10 +112,10 @@ async function guildWeekly() {
timestamp: new Date().toISOString(),
footer: {
text: channel.guild.name + " | " + devMessage,
icon_url: channel.guild.iconURL() || undefined,
},
},
],
icon_url: channel.guild.iconURL() || undefined
}
}
]
})
}
@@ -129,10 +126,10 @@ export = {
hours: 21,
dayOfWeek: 7,
dayOfMonth: "*",
month: "*",
month: "*"
},
execute: guildWeekly,
onComplete: null,
start: true,
timeZone: "Europe/Zagreb",
timeZone: "Europe/Zagreb"
} as Cron

View File

@@ -23,15 +23,15 @@ export = {
member.user.createdAt.toLocaleString(),
color: embedColor,
thumbnail: {
url: member.user.avatarURL() || "",
url: member.user.avatarURL() || ""
},
footer: {
text: "ID: " + member.id,
icon_url: member.user.avatarURL() || undefined,
icon_url: member.user.avatarURL() || undefined
},
timestamp: new Date().toISOString(),
},
],
timestamp: new Date().toISOString()
}
]
})
},
}
} as Event

View File

@@ -17,8 +17,8 @@ export = {
interaction.commandName +
" " +
interaction.options.getSubcommand(),
"pink",
),
"pink"
)
)
} catch {
console.log(
@@ -26,8 +26,8 @@ export = {
interaction.user.username +
" ran " +
interaction.commandName,
"pink",
),
"pink"
)
)
}
}
@@ -40,10 +40,10 @@ export = {
interaction.user.discriminator +
" clicked " +
interaction.customId,
"pink",
),
"pink"
)
)
return
}
},
}
} as Event

View File

@@ -21,18 +21,18 @@ export = {
await message.channel.send({
embeds: [
{
description: `\`\`\`js\n${outputString}\`\`\``,
},
],
description: `\`\`\`js\n${outputString}\`\`\``
}
]
})
} catch (error) {
await message.channel.send({
embeds: [
{
description: `\`\`\`js\n${error}\`\`\``,
},
],
description: `\`\`\`js\n${error}\`\`\``
}
]
})
}
},
}
} as Event

View File

@@ -13,5 +13,5 @@ export = {
) {
message.react("Woot:734345936347725885")
}
},
}
} as Event

View File

@@ -20,16 +20,16 @@ export = {
channel: message.channel.id,
createdAt: message.createdTimestamp,
deletedAt: Date.now(),
attachments: message.attachments.map(a => a.url) || [],
attachments: message.attachments.map(a => a.url) || []
}
const snipeCache = new snipeCacheSchema({
_id: new mongoose.Types.ObjectId(),
userid: message.author.id,
channelid: message.channel.id,
data: msg,
data: msg
})
await snipeCache.save()
},
}
} as Event

View File

@@ -9,5 +9,5 @@ export = {
execute(client: Client) {
console.log(color("Logged in as " + client.user!.tag + "!", "green"))
},
}
} as Event

View File

@@ -16,9 +16,9 @@ export = {
embeds: [
{
description: "Bot is online!",
color: embedColor,
},
],
color: embedColor
}
]
})
},
}
} as Event

View File

@@ -22,9 +22,9 @@ export = {
let i = 1
setInterval(
() => user.setActivity(statuses[i++ % statuses.length]),
1000 * 60 * 10,
1000 * 60 * 10
)
user.setStatus("dnd")
},
}
} as Event

View File

@@ -28,11 +28,11 @@ export = {
footer: {
text: "ID: " + newState.member!.id,
icon_url:
newState.member!.user.avatarURL() || undefined,
newState.member!.user.avatarURL() || undefined
},
timestamp: new Date().toISOString(),
},
],
timestamp: new Date().toISOString()
}
]
})
} else if (oldChannel !== null && newChannel === null) {
logToChannel("bot", {
@@ -47,11 +47,11 @@ export = {
footer: {
text: "ID: " + oldState.member!.id,
icon_url:
oldState.member!.user.avatarURL() || undefined,
oldState.member!.user.avatarURL() || undefined
},
timestamp: new Date().toISOString(),
},
],
timestamp: new Date().toISOString()
}
]
})
} else if (oldChannel !== null && newChannel !== null) {
if (oldChannel.id === newChannel.id) return
@@ -70,12 +70,12 @@ export = {
footer: {
text: "ID: " + oldState.member!.id,
icon_url:
oldState.member!.user.avatarURL() || undefined,
oldState.member!.user.avatarURL() || undefined
},
timestamp: new Date().toISOString(),
},
],
timestamp: new Date().toISOString()
}
]
})
}
},
}
} as Event