mirror of
https://github.com/musix-org/musix-oss
synced 2025-08-01 20:54:33 +00:00
New config system and error logging
This commit is contained in:
16
index.js
16
index.js
@@ -1,4 +1,5 @@
|
||||
const config = require("./src/struct/config/config.js");
|
||||
const DiscordWebhook = require("discord-webhook-node");
|
||||
|
||||
if (config.devMode) {
|
||||
console.log("- dev mode- ");
|
||||
@@ -6,9 +7,7 @@ if (config.devMode) {
|
||||
config.shards = 1;
|
||||
}
|
||||
|
||||
const {
|
||||
ShardingManager
|
||||
} = require("discord.js");
|
||||
const { ShardingManager } = require("discord.js");
|
||||
const manager = new ShardingManager("./src/bot.js", {
|
||||
token: config.token,
|
||||
respawn: config.respawn,
|
||||
@@ -19,4 +18,13 @@ console.log("- Launching shards -");
|
||||
manager.spawn(config.shards, config.shardDelay, config.shardTimeout);
|
||||
manager.on("shardCreate", (shard) =>
|
||||
console.log(`- Launched shard ${shard.id} -`)
|
||||
);
|
||||
);
|
||||
|
||||
const webhookClient = new DiscordWebhook.Webhook(config.webhookUrl);
|
||||
|
||||
const oldConsole = {};
|
||||
oldConsole.log = console.log;
|
||||
console.log = function (arg) {
|
||||
oldConsole.log(arg);
|
||||
webhookClient.send(arg);
|
||||
};
|
||||
|
Reference in New Issue
Block a user