Compare commits

...

3 commits

Author SHA1 Message Date
08b62b1175
disable ok-lines
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 10s
2024-09-04 13:06:54 +02:00
055bb60d22
comments
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 15s
2024-09-04 13:04:11 +02:00
98bafc2e86 add basic sharding
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 21s
2024-09-04 13:01:31 +02:00
2 changed files with 16 additions and 7 deletions

6
src/bot.ts Normal file
View file

@ -0,0 +1,6 @@
/** Load the app */
const start_app = () => {
import("./load").then((l) => l.run().catch((error) => console.error(error)));
};
start_app();

View file

@ -1,17 +1,20 @@
/** Load the app. */
const start_app = () => {
import("./load").then((l) => l.run().catch((error) => console.error(error)));
import { ShardingManager } from "discord.js";
const start_manager = () => {
const manager = new ShardingManager("./dist/bot.js", { token: process.env.TOKEN_DISCORD });
manager.on("shardCreate", (shard) => console.log(`Launched shard ${shard.id}`));
manager.spawn();
};
// Load .env if not in prod
if (process.env.NODE_ENV !== "production") {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import("dotenv").then((c) => {
c.config({ path: "./config/.env" });
start_app();
start_manager();
});
} else {
start_app();
start_manager();
}