Skyler Grey | cf77140 | 2023-03-05 07:06:37 +0000 | [diff] [blame] | 1 | import "@total-typescript/ts-reset"; |
| 2 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 3 | import runServer from "./api/index.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 4 | import client from "./utils/client.js"; |
pineafan | a2e39c7 | 2023-02-21 18:37:32 +0000 | [diff] [blame] | 5 | import config from "./config/main.js"; |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 6 | import register from "./utils/commandRegistration/register.js"; |
PineaFan | 538d375 | 2023-01-12 21:48:23 +0000 | [diff] [blame] | 7 | import { record as recordPerformance } from "./utils/performanceTesting/record.js"; |
Skyler Turner | 66ac794 | 2022-02-24 01:59:22 +0000 | [diff] [blame] | 8 | |
TheCodedProf | 1c3ad3c | 2023-01-25 17:58:36 -0500 | [diff] [blame] | 9 | client.on("ready", async () => { |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 10 | console.log(`Logged in as ${client.user!.tag}!`); |
Skyler Grey | f4f21c4 | 2023-03-08 14:36:29 +0000 | [diff] [blame] | 11 | await register(); |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 12 | runServer(client); |
TheCodedProf | f86ba09 | 2023-01-27 17:10:07 -0500 | [diff] [blame] | 13 | if (config.enableDevelopment) { |
| 14 | client.fetchedCommands = await client.guilds.cache.get(config.developmentGuildID)?.commands.fetch()!; |
| 15 | } else { |
| 16 | client.fetchedCommands = await client.application?.commands.fetch()!; |
| 17 | } |
TheCodedProf | 94ff6de | 2023-02-22 17:47:26 -0500 | [diff] [blame] | 18 | await client.database.premium.checkAllPremium(); |
TheCodedProf | b7a7b99 | 2023-03-05 16:11:59 -0500 | [diff] [blame] | 19 | await client.database.guilds.updateAllGuilds(); |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 20 | }); |
TheCodedProf | 94ff6de | 2023-02-22 17:47:26 -0500 | [diff] [blame] | 21 | |
Skyler Grey | da16adf | 2023-03-05 10:22:12 +0000 | [diff] [blame] | 22 | process.on("unhandledRejection", (err) => { |
| 23 | console.error(err); |
| 24 | }); |
| 25 | process.on("uncaughtException", (err) => { |
| 26 | console.error(err); |
| 27 | }); |
pineafan | 1dc1572 | 2022-03-14 21:27:34 +0000 | [diff] [blame] | 28 | |
Skyler Grey | b86eb7e | 2023-06-14 14:03:18 +0200 | [diff] [blame^] | 29 | await client.login(config.token); |
PineaFan | 538d375 | 2023-01-12 21:48:23 +0000 | [diff] [blame] | 30 | |
TheCodedProf | 4f79da1 | 2023-01-31 16:50:37 -0500 | [diff] [blame] | 31 | await recordPerformance(); |