This repository has been archived by the owner on May 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.js
53 lines (44 loc) · 1.78 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* eslint-disable no-template-curly-in-string */
// IMPORTANT:
// Do not edit this file - edit config.json instead.
const path = require("path");
const _ = require("lodash");
const util = require("./util");
const loadJSON = util.loadJSON;
const saveJSON = util.saveJSON;
const defaultConfig = {
eris: {
token: "TOKEN GOES HERE",
id: "CHANNEL ID GOES HERE",
topicTimeout: 300000,
playing: "Just Cause 3 Multiplayer"
},
formatting: {
discordToGame: {
chat: "${nick}: ${message}",
colour: "7289DA"
},
gameToDiscord: {
topic: "Join the server at xxx.xxx.xxx.xxx:port | ${players}/${maxPlayers} players currently online | Current tick rate: ${jcmp.server.currentTickRate}",
chat: "${username}: ${message}",
death: "*${username} ${(killer && killer.name ? \"was killed by \" + killer.name : \"died\")}*",
connect: "**${username} connected to the server.**",
disconnect: "**${username} disconnected from the server.**",
dConnect: "**Server started.**",
dReconnect: "**Reconnected to Discord.**",
dExit: "**Server stopped.**",
}
},
version: "0.2.0",
};
function getFullConfig() {
const configPath = path.join(__dirname, "./config.json");
const loadedConfig = loadJSON(configPath);
if (loadedConfig.version &&
!util.isVersionCompatible(defaultConfig.version, loadedConfig.version)) throw new Error("Your config.json is not compatible with this version of Justcord. Please update your config.");
const fullConfig = _.merge({}, defaultConfig, loadedConfig);
saveJSON(configPath, fullConfig);
return fullConfig;
}
module.exports = getFullConfig;
module.exports.defaultConfig = defaultConfig;