mirror of https://github.com/thaldrin/thaldrin.git
different sharding method
This commit is contained in:
parent
e441cc43fd
commit
9afec41467
11
index.ts
11
index.ts
|
@ -1,13 +1,4 @@
|
|||
//@ts-ignore
|
||||
import config from "./config";
|
||||
import client from "./src/handler/client/Client"
|
||||
import { Util } from "discord.js";
|
||||
import Logger from "./src/utils/logger";
|
||||
Util.fetchRecommendedShards(config.token).then((count) => {
|
||||
// console.log(`Starting ${config.variables.name}`)
|
||||
Logger.info({
|
||||
message: `Starting ${config.variables.name} with ${count} Shards`,
|
||||
type: "event:start"
|
||||
})
|
||||
new client(config, count)
|
||||
})
|
||||
let Bot = new client(config)
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"name": "thaldrin",
|
||||
"version": "4.0.0-dev",
|
||||
"description": "",
|
||||
"main": "build/index.js",
|
||||
"main": "build/shard.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"start": "node build/index.js",
|
||||
"start": "node build/shard.js",
|
||||
"dev": "npm run build && npm run start",
|
||||
"init": "npm run subs:init && npm run sub:update",
|
||||
"subs:init": "git submodules init && git submodule update",
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
import { ShardingManager } from "discord.js";
|
||||
import config from "./config";
|
||||
let Sharder = new ShardingManager('./build/index.js', {
|
||||
token: config.token,
|
||||
totalShards: "auto"
|
||||
})
|
||||
|
||||
Sharder.on("shardCreate", async (shard) => {
|
||||
console.log(`Launched Shard #${shard.id}`)
|
||||
})
|
||||
|
||||
Sharder.spawn()
|
Loading…
Reference in New Issue