blob: 87bbc02b1adf5321d2f9815965e225e5e7d07e4c [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001import { Logger } from "./utils/log.js";
2import runServer from "./api/index.js";
3import Memory from "./utils/memory.js";
Skyler Grey11236ba2022-08-08 21:13:33 +01004import type { VerifySchema } from "./reflex/verify.js";
pineafan63fc5e22022-08-04 22:04:10 +01005import { Guilds, History, ModNotes, Premium } from "./utils/database.js";
6import client from "./utils/client.js";
7import EventScheduler from "./utils/eventScheduler.js";
Skyler Grey11236ba2022-08-08 21:13:33 +01008import type { RoleMenuSchema } from "./actions/roleMenu.js";
Skyler Turner66ac7942022-02-24 01:59:22 +00009
Skyler Greyc634e2b2022-08-06 17:50:48 +010010await client.registerCommandsIn(`dist/commands`);
11await client.registerEventsIn(`dist/events`);
pineafane625d782022-05-09 18:04:32 +010012client.on("ready", () => {
13 runServer(client);
14});
pineafan02ba0232022-07-24 22:16:15 +010015process.on("unhandledRejection", (err) => {
16 console.error(err);
17});
pineafan1dc15722022-03-14 21:27:34 +000018
Skyler Grey11236ba2022-08-08 21:13:33 +010019client.logger = new Logger() as Logger;
20client.verify = {} as Record<string, VerifySchema>;
21client.roleMenu = {} as Record<string, RoleMenuSchema>;
22client.memory = new Memory() as Memory;
23client.noLog = [] as string[];
pineafan4edb7762022-06-26 19:21:04 +010024client.database = {
25 guilds: await new Guilds().setup(),
26 history: await new History().setup(),
27 notes: await new ModNotes().setup(),
pineafan73a7c4a2022-07-24 10:38:04 +010028 premium: await new Premium().setup(),
29 eventScheduler: await new EventScheduler().start()
Skyler Grey11236ba2022-08-08 21:13:33 +010030} as {
31 guilds: Guilds;
32 history: History;
33 notes: ModNotes;
34 premium: Premium;
35 eventScheduler: EventScheduler;
pineafan63fc5e22022-08-04 22:04:10 +010036};
pineafan6fb3e072022-05-20 19:27:23 +010037
Skyler Grey75ea9172022-08-06 10:22:23 +010038await client.login();