Ran yarn format

This commit is contained in:
2023-12-30 17:35:18 +01:00
parent 443c20a559
commit 7f7b14ce21
17 changed files with 61 additions and 40 deletions

View File

@@ -52,7 +52,9 @@ export = {
} }
if (!userRoles.has(guildRole)) { if (!userRoles.has(guildRole)) {
await interaction.editReply("You must be a member of the guild to apply for staff.") await interaction.editReply(
"You must be a member of the guild to apply for staff.",
)
return return
} }

View File

@@ -2,7 +2,7 @@ import {
hypixelGuildID, hypixelGuildID,
guildLogChannel, guildLogChannel,
color, color,
devMessage devMessage,
} from "../../../config/options.json" } from "../../../config/options.json"
import { getGuild, getIGN } from "../../utils/Hypixel" import { getGuild, getIGN } from "../../utils/Hypixel"
import { Cron, GuildData } from "../../interfaces" import { Cron, GuildData } from "../../interfaces"
@@ -23,10 +23,12 @@ async function guildWeekly() {
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
const message = await channel.send({ const message = await channel.send({
embeds: [{ embeds: [
description: "Starting to fetch guild data...", {
color: embedColor description: "Starting to fetch guild data...",
}] color: embedColor,
},
],
}) })
const guild = (await getGuild(hypixelGuildID, "id")) as GuildData const guild = (await getGuild(hypixelGuildID, "id")) as GuildData

View File

@@ -16,11 +16,19 @@ async function autoDeployCommands(fileType: FileType) {
let contentMenuCommands: string[] = [] let contentMenuCommands: string[] = []
if (fileType === "js") { if (fileType === "js") {
commandFiles = fs.readdirSync("./dist/src/commands/").filter(file => file.endsWith(fileType)) commandFiles = fs
contentMenuCommands = fs.readdirSync("./dist/src/commands-contextmenu/").filter(file => file.endsWith(fileType)) .readdirSync("./dist/src/commands/")
.filter(file => file.endsWith(fileType))
contentMenuCommands = fs
.readdirSync("./dist/src/commands-contextmenu/")
.filter(file => file.endsWith(fileType))
} else if (fileType === "ts") { } else if (fileType === "ts") {
commandFiles = fs.readdirSync("./src/commands/").filter(file => file.endsWith(fileType)) commandFiles = fs
contentMenuCommands = fs.readdirSync("./src/commands-contextmenu/").filter(file => file.endsWith(fileType)) .readdirSync("./src/commands/")
.filter(file => file.endsWith(fileType))
contentMenuCommands = fs
.readdirSync("./src/commands-contextmenu/")
.filter(file => file.endsWith(fileType))
} }
for (const file of commandFiles) { for (const file of commandFiles) {
@@ -86,10 +94,7 @@ async function autoDeployCommands(fileType: FileType) {
try { try {
console.log( console.log(
color.colorize( color.colorize("Commands are different, starting deploy.", "red"),
"Commands are different, starting deploy.",
"red",
),
) )
console.log(color.colorize(currentCmds, "red")) console.log(color.colorize(currentCmds, "red"))
console.log( console.log(
@@ -97,10 +102,7 @@ async function autoDeployCommands(fileType: FileType) {
) )
const data = (await rest.put( const data = (await rest.put(
Routes.applicationGuildCommands( Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!),
env.dev.devid!,
env.dev.guildid!,
),
{ body: commands }, { body: commands },
)) as RESTPutAPIApplicationGuildCommandsJSONBody[] )) as RESTPutAPIApplicationGuildCommandsJSONBody[]

View File

@@ -35,7 +35,6 @@ export class ExtendedClient extends Client {
} }
async start() { async start() {
let token: string let token: string
if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) { if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) {
console.log("Running in development mode. [ts-node]") console.log("Running in development mode. [ts-node]")

View File

@@ -17,5 +17,4 @@ export default function init() {
if (!value) throw new Error(`No ${key} specified`) if (!value) throw new Error(`No ${key} specified`)
} }
} }
} }

View File

@@ -7,9 +7,7 @@ import { FileType } from "../../typings"
export default function loadButtonEvents(client: Client, ft: FileType) { export default function loadButtonEvents(client: Client, ft: FileType) {
const btnPath = path.join(__dirname, "..", "..", "events", "buttons") const btnPath = path.join(__dirname, "..", "..", "events", "buttons")
const btnFiles = fs const btnFiles = fs.readdirSync(btnPath).filter(file => file.endsWith(ft))
.readdirSync(btnPath)
.filter(file => file.endsWith(ft))
for (const file of btnFiles) { for (const file of btnFiles) {
const filePath = path.join(btnPath, file) const filePath = path.join(btnPath, file)

View File

@@ -7,7 +7,7 @@ import { FileType } from "../../typings"
export default function loadSlashCommandsEvents(client: Client, ft: FileType) { export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
const cmdPath = path.join(__dirname, "..", "..", "commands") const cmdPath = path.join(__dirname, "..", "..", "commands")
const cmdFiles = fs .readdirSync(cmdPath) .filter(file => file.endsWith(ft)) const cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith(ft))
for (const file of cmdFiles) { for (const file of cmdFiles) {
const filePath = path.join(cmdPath, file) const filePath = path.join(cmdPath, file)

View File

@@ -5,14 +5,33 @@ import { Cron } from "../../interfaces"
export default function loadCronEvents() { export default function loadCronEvents() {
const cronPath = path.join(__dirname, "..", "..", "events", "cron") const cronPath = path.join(__dirname, "..", "..", "events", "cron")
const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(".js")) const cronFiles = fs
.readdirSync(cronPath)
.filter(file => file.endsWith(".js"))
for (const file of cronFiles) { for (const file of cronFiles) {
const filePath = path.join(cronPath, file) const filePath = path.join(cronPath, file)
const cron: Cron = require(filePath) const cron: Cron = require(filePath)
const time = cron.time.seconds + " " + cron.time.minutes + " " + cron.time.hours + " " + cron.time.dayOfMonth + " " + cron.time.month + " " + cron.time.dayOfWeek const time =
cron.time.seconds +
" " +
cron.time.minutes +
" " +
cron.time.hours +
" " +
cron.time.dayOfMonth +
" " +
cron.time.month +
" " +
cron.time.dayOfWeek
new CronJob(time, cron.execute, cron.onComplete, cron.start, cron.timeZone).start() new CronJob(
time,
cron.execute,
cron.onComplete,
cron.start,
cron.timeZone,
).start()
} }
} }

View File

@@ -13,5 +13,5 @@ export {
loadContextMenuEvents, loadContextMenuEvents,
loadCronEvents, loadCronEvents,
loadEvents, loadEvents,
loadModalEvents loadModalEvents,
} }