Compare commits

...

3 commits

Author SHA1 Message Date
e1ea84c013 add basic sharding
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 19s
2024-09-04 10:05:48 +02:00
aded2add59
fix: add pr types for action (#155)
All checks were successful
Publish latest version / build (push) Successful in 1m45s
Reviewed-on: #155
Co-authored-by: Mylloon <kennel.anri@tutanota.com>
Co-committed-by: Mylloon <kennel.anri@tutanota.com>
2024-09-04 10:05:20 +02:00
0c617d6855
add action for pull requests (#152)
All checks were successful
Publish latest version / build (push) Successful in 1m26s
Closes #151

Reviewed-on: #152
Co-authored-by: Mylloon <kennel.anri@tutanota.com>
Co-committed-by: Mylloon <kennel.anri@tutanota.com>
2024-09-04 09:57:53 +02:00
3 changed files with 39 additions and 6 deletions

View file

@ -0,0 +1,23 @@
name: Lint and Format Check
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- dev
jobs:
lint-and-format:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Run lint
run: npm run lint
- name: Run format check
run: npm run format-check

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,21 @@
/** 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();
}