Skip to content

Commit

Permalink
Merge formatting
Browse files Browse the repository at this point in the history
Merge formatting into main
  • Loading branch information
github-actions[bot] authored Sep 7, 2024
2 parents b51b12f + 9a4d40f commit 9db46af
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/events/ready.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
17 changes: 10 additions & 7 deletions src/util/expressServer.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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),
Expand All @@ -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" });
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/util/wouldYou.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, ChatInputCommand>;
Expand Down

0 comments on commit 9db46af

Please sign in to comment.