ran prettier lol
All checks were successful
CI / build (push) Successful in 10s

This commit is contained in:
Space-Banane
2026-02-22 15:31:37 +01:00
parent bc58cb7361
commit e1300a98b3
17 changed files with 473 additions and 408 deletions

View File

@@ -1,47 +1,55 @@
import { Client, Events, GatewayIntentBits, Message, Partials } from 'discord.js';
import dotenv from 'dotenv';
import path from 'path';
import loadModulesFromDir from './lib/loadStartupHandlers';
import {
Client,
Events,
GatewayIntentBits,
Message,
Partials,
} from "discord.js";
import dotenv from "dotenv";
import path from "path";
import loadModulesFromDir from "./lib/loadStartupHandlers";
import * as mongoDB from "mongodb";
import { env } from 'process';
import webserver from './webserver';
import { env } from "process";
import webserver from "./webserver";
dotenv.config();
const dbclient: mongoDB.MongoClient = new mongoDB.MongoClient(
env.MONGO_DB!
);
const dbclient: mongoDB.MongoClient = new mongoDB.MongoClient(env.MONGO_DB!);
const db: mongoDB.Db = dbclient.db(env.DB_NAME!);
export { db, dbclient };
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction, Partials.User],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.User,
],
});
let readyClient: typeof client | null = null;
client.once(Events.ClientReady, async (rc) => {
readyClient = rc;
console.log(`Logged in as ${rc.user.tag}`);
readyClient = rc;
console.log(`Logged in as ${rc.user.tag}`);
const dirs = [
path.join(__dirname, 'commands'), // load commands first
path.join(__dirname, 'handlers'),
path.join(__dirname, 'listeners'),
];
const dirs = [
path.join(__dirname, "commands"), // load commands first
path.join(__dirname, "handlers"),
path.join(__dirname, "listeners"),
];
for (const dir of dirs) {
await loadModulesFromDir(dir, client);
}
for (const dir of dirs) {
await loadModulesFromDir(dir, client);
}
});
// Start webserver in the background
@@ -50,4 +58,4 @@ webserver().catch(console.error);
// Exports
export { client, readyClient };
client.login(process.env.DISCORD_TOKEN);
client.login(process.env.DISCORD_TOKEN);