diff --git a/src/events/ready.ts b/src/events/ready.ts index fd8d11b0..27989de1 100644 --- a/src/events/ready.ts +++ b/src/events/ready.ts @@ -15,7 +15,6 @@ const event: Event = { event: "ready", execute: async (client: WouldYou) => { if (client.cluster.id === 0) { - client.server.startServer(); let globalCommands = Array.from( diff --git a/src/util/expressServer.ts b/src/util/expressServer.ts index 61d1c20f..ed3711d5 100644 --- a/src/util/expressServer.ts +++ b/src/util/expressServer.ts @@ -1,6 +1,6 @@ -import express, { Request, Response } from 'express'; -import type { WebSocketShard, Guild, Shard } from 'discord.js'; -import type WouldYou from '../util/wouldYou'; +import type { Guild, WebSocketShard } from "discord.js"; +import express, { Request, Response } from "express"; +import type WouldYou from "../util/wouldYou"; interface ShardStats { id: number; @@ -29,7 +29,9 @@ export default class ExpressServer { id: shard.id, status: shard.status, ping: Math.floor(shard.ping), - guilds: client.guilds.cache.filter((g: Guild) => g.shardId === shard.id).size, + guilds: client.guilds.cache.filter( + (g: Guild) => g.shardId === shard.id, + ).size, members: client.guilds.cache .filter((g: Guild) => g.shardId === shard.id) .reduce((a: number, b: Guild) => a + b.memberCount, 0), @@ -41,13 +43,14 @@ export default class ExpressServer { } private initializeRoutes(): void { - this.app.get('/api/status', async (req: Request, res: Response) => { - if(req.headers.authorization !== process.env.AUTH) return res.status(401).json({ error: 'Unauthorized' }); + this.app.get("/api/status", async (req: Request, res: Response) => { + if (req.headers.authorization !== process.env.AUTH) + return res.status(401).json({ error: "Unauthorized" }); try { const stats = await this.getRequestStats(); res.json(stats); } catch (error) { - res.status(500).json({ error: 'Failed to fetch stats' }); + res.status(500).json({ error: "Failed to fetch stats" }); } }); } diff --git a/src/util/wouldYou.ts b/src/util/wouldYou.ts index 2b86de2f..1c06145f 100644 --- a/src/util/wouldYou.ts +++ b/src/util/wouldYou.ts @@ -14,19 +14,19 @@ import "dotenv/config"; // Classes for the bot import path from "path"; -import Config, { IConfig } from "../config"; +import { IConfig } from "../config"; import { Button, ChatInputCommand } from "../interfaces"; import { Event } from "../interfaces/event"; import { fileToCollection } from "./Functions/fileToCollection"; import CooldownHandler from "./cooldownHandler"; import DailyMessage from "./dailyMessage"; import DatabaseHandler from "./databaseHandler"; +import ExpressServer from "./expressServer"; import KeepAlive from "./keepAlive"; import PremiumHandler from "./premiumHandler"; import TranslationHandler from "./translationHandler"; import Voting from "./votingHandler"; import WebhookHandler from "./webhookHandler"; -import ExpressServer from "./expressServer"; export default class WouldYou extends Client { public commands: Collection;