pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | import { Logger } from "./utils/log.js"; |
| 2 | import runServer from "./api/index.js"; |
| 3 | import Memory from "./utils/memory.js"; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 4 | import type { VerifySchema } from "./reflex/verify.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 5 | import { Guilds, History, ModNotes, Premium } from "./utils/database.js"; |
| 6 | import client from "./utils/client.js"; |
| 7 | import EventScheduler from "./utils/eventScheduler.js"; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 8 | import type { RoleMenuSchema } from "./actions/roleMenu.js"; |
Skyler Turner | 66ac794 | 2022-02-24 01:59:22 +0000 | [diff] [blame] | 9 | |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 10 | await client.registerCommandsIn(`dist/commands`); |
| 11 | await client.registerEventsIn(`dist/events`); |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 12 | client.on("ready", () => { |
| 13 | runServer(client); |
| 14 | }); |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame] | 15 | process.on("unhandledRejection", (err) => { |
| 16 | console.error(err); |
| 17 | }); |
pineafan | 1dc1572 | 2022-03-14 21:27:34 +0000 | [diff] [blame] | 18 | |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 19 | client.logger = new Logger() as Logger; |
| 20 | client.verify = {} as Record<string, VerifySchema>; |
| 21 | client.roleMenu = {} as Record<string, RoleMenuSchema>; |
| 22 | client.memory = new Memory() as Memory; |
| 23 | client.noLog = [] as string[]; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 24 | client.database = { |
| 25 | guilds: await new Guilds().setup(), |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 26 | history: new History(), |
| 27 | notes: new ModNotes(), |
| 28 | premium: new Premium(), |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 29 | eventScheduler: await new EventScheduler().start() |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 30 | } as { |
| 31 | guilds: Guilds; |
| 32 | history: History; |
| 33 | notes: ModNotes; |
| 34 | premium: Premium; |
| 35 | eventScheduler: EventScheduler; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 36 | }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 37 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 38 | await client.login(); |