Compare commits
5 commits
08b62b1175
...
0747c3ebe4
Author | SHA1 | Date | |
---|---|---|---|
0747c3ebe4 | |||
e43234f790 | |||
12f57e9195 | |||
110142c2e7 | |||
8071bc8226 |
4 changed files with 18 additions and 7 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"editor.tabSize": 2,
|
"editor.tabSize": 2,
|
||||||
"editor.insertSpaces": false,
|
"editor.insertSpaces": false,
|
||||||
|
"editor.rulers": [100],
|
||||||
|
|
||||||
"files.insertFinalNewline": true,
|
"files.insertFinalNewline": true,
|
||||||
"files.trimFinalNewlines": true,
|
"files.trimFinalNewlines": true,
|
||||||
|
|
6
src/bot.ts
Normal file
6
src/bot.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/** Load the app */
|
||||||
|
const start_app = () => {
|
||||||
|
import("./load").then((l) => l.run().catch((error) => console.error(error)));
|
||||||
|
};
|
||||||
|
|
||||||
|
start_app();
|
17
src/index.ts
17
src/index.ts
|
@ -1,17 +1,20 @@
|
||||||
/** Load the app. */
|
import { ShardingManager } from "discord.js";
|
||||||
const start_app = () => {
|
|
||||||
import("./load").then((l) => l.run().catch((error) => console.error(error)));
|
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
|
// Load .env if not in prod
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== "production") {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
import("dotenv").then((c) => {
|
import("dotenv").then((c) => {
|
||||||
c.config({ path: "./config/.env" });
|
c.config({ path: "./config/.env" });
|
||||||
|
|
||||||
start_app();
|
start_manager();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
start_app();
|
start_manager();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { YoutubeiExtractor } from "discord-player-youtubei";
|
||||||
/** Creation of the client and definition of its properties */
|
/** Creation of the client and definition of its properties */
|
||||||
export default async () => {
|
export default async () => {
|
||||||
const client: Client = new Client({
|
const client: Client = new Client({
|
||||||
|
shards: "auto",
|
||||||
intents: [
|
intents: [
|
||||||
GatewayIntentBits.Guilds,
|
GatewayIntentBits.Guilds,
|
||||||
GatewayIntentBits.GuildMessages,
|
GatewayIntentBits.GuildMessages,
|
||||||
|
|
Loading…
Reference in a new issue