pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | import runServer from "./api/index.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 2 | import client from "./utils/client.js"; |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 3 | import config from "./config/main.json" assert { type: "json" }; |
| 4 | import register from "./utils/commandRegistration/register.js"; |
PineaFan | 538d375 | 2023-01-12 21:48:23 +0000 | [diff] [blame] | 5 | import { record as recordPerformance } from "./utils/performanceTesting/record.js"; |
Skyler Turner | 66ac794 | 2022-02-24 01:59:22 +0000 | [diff] [blame] | 6 | |
TheCodedProf | 1c3ad3c | 2023-01-25 17:58:36 -0500 | [diff] [blame] | 7 | client.on("ready", async () => { |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 8 | console.log(`Logged in as ${client.user!.tag}!`); |
| 9 | register(); |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 10 | runServer(client); |
TheCodedProf | f86ba09 | 2023-01-27 17:10:07 -0500 | [diff] [blame] | 11 | if (config.enableDevelopment) { |
| 12 | client.fetchedCommands = await client.guilds.cache.get(config.developmentGuildID)?.commands.fetch()!; |
| 13 | } else { |
| 14 | client.fetchedCommands = await client.application?.commands.fetch()!; |
| 15 | } |
TheCodedProf | d0a166d | 2023-02-19 00:04:53 -0500 | [diff] [blame] | 16 | setInterval(async () => { |
| 17 | await client.database.premium.checkAllPremium(); |
| 18 | }, 1000 * 60 * 3); |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 19 | }); |
PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 20 | process.on("unhandledRejection", (err) => { console.error(err) }); |
| 21 | process.on("uncaughtException", (err) => { console.error(err) }); |
pineafan | 1dc1572 | 2022-03-14 21:27:34 +0000 | [diff] [blame] | 22 | |
PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 23 | await client.login(config.enableDevelopment ? config.developmentToken : config.token) |
PineaFan | 538d375 | 2023-01-12 21:48:23 +0000 | [diff] [blame] | 24 | |
TheCodedProf | 4f79da1 | 2023-01-31 16:50:37 -0500 | [diff] [blame] | 25 | await recordPerformance(); |