xyter/src/index.ts
deepsource-autofix[bot] 9a528e98fb
Format code with standardjs and prettier
This commit fixes the style issues introduced in 9780e8c according to the output
from standardjs and prettier.

Details: https://deepsource.io/gh/ZynerOrg/xyter/transform/dcd0e7f9-fa2c-4994-b383-8bbe416990d2/
2022-05-17 09:52:56 +00:00

65 lines
1.5 KiB
TypeScript

import "tsconfig-paths/register"; // Allows using tsconfig.json paths during runtime
import { token, intents } from "@config/discord";
import { Client } from "discord.js"; // discord.js
import database from "@database";
import schedules from "@schedules";
import events from "@handlers/events";
import commands from "@handlers/commands";
// Main process that starts all other sub processes
const main = async () => {
// Initiate client object
const client = new Client({
intents,
});
// Start database manager
await database()
.then(async () => {
await logger.silly("Database process started");
})
.catch(async (err) => {
await logger.error(err);
});
// Start schedule manager
await schedules(client)
.then(async () => {
await logger.silly("Schedules process started");
})
.catch(async (err) => {
await logger.error(err);
});
// Start command handler
await commands(client)
.then(async () => {
await logger.silly("Commands process started");
})
.catch(async (err) => {
await logger.error(err);
});
// Start event handler
await events(client)
.then(async () => {
await logger.silly("Events process started");
})
.catch(async (err) => {
await logger.error(err);
});
// Authorize with Discord's API
await client.login(token);
};
await main()
.then(async () => {
await logger.silly("Main process started");
})
.catch(async (err) => {
await logger.error(err);
});