1
0
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:
MatteZ02
2020-06-16 21:51:11 +03:00
parent 3a1ad33dd6
commit 4b3b798ddc
9 changed files with 101 additions and 71 deletions

View File

@@ -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);
};